Files
TubeCards/lib/utils/icon_sized_loading_indicator.dart
friebetill 80f218097d Initial commit
Add Space version 2.0.1
2022-03-28 14:56:00 +02:00

29 lines
870 B
Dart

import 'package:flutter/material.dart';
/// A loading indicator that has the same size as an default icon.
///
/// An icon is 20x20 pixels by default, but a loading indicator that is
/// also 20x20 is proportionally too large. Therefore this widget returns
/// a 16x16 pixel loading indiciator with a 4 pixel padding.
class IconSizedLoadingIndicator extends StatelessWidget {
const IconSizedLoadingIndicator({this.color, Key? key}) : super(key: key);
/// The color of the loading indicator.
final Color? color;
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.all(4),
child: SizedBox(
height: 16,
width: 16,
child: CircularProgressIndicator(
strokeWidth: 2,
valueColor: color != null ? AlwaysStoppedAnimation(color) : null,
),
),
);
}
}