56 lines
1.4 KiB
Dart
56 lines
1.4 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import 'a11y/a11y_labels.dart';
|
|
|
|
class AppProgressIndicator extends StatelessWidget {
|
|
final double size;
|
|
final double strokeWidth;
|
|
final Color? color;
|
|
final String semanticsLabel;
|
|
|
|
const AppProgressIndicator._({
|
|
required this.size,
|
|
required this.strokeWidth,
|
|
this.color,
|
|
this.semanticsLabel = A11yLabels.loading,
|
|
});
|
|
|
|
const AppProgressIndicator.small({Color? color, String? semanticsLabel})
|
|
: this._(
|
|
size: 16,
|
|
strokeWidth: 2,
|
|
color: color,
|
|
semanticsLabel: semanticsLabel ?? A11yLabels.loading,
|
|
);
|
|
|
|
const AppProgressIndicator.medium({Color? color, String? semanticsLabel})
|
|
: this._(
|
|
size: 24,
|
|
strokeWidth: 2.5,
|
|
color: color,
|
|
semanticsLabel: semanticsLabel ?? A11yLabels.loading,
|
|
);
|
|
|
|
const AppProgressIndicator.large({Color? color, String? semanticsLabel})
|
|
: this._(
|
|
size: 40,
|
|
strokeWidth: 3,
|
|
color: color,
|
|
semanticsLabel: semanticsLabel ?? A11yLabels.loading,
|
|
);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final resolved = color ?? Theme.of(context).colorScheme.primary;
|
|
return SizedBox(
|
|
width: size,
|
|
height: size,
|
|
child: CircularProgressIndicator(
|
|
strokeWidth: strokeWidth,
|
|
valueColor: AlwaysStoppedAnimation<Color>(resolved),
|
|
semanticsLabel: semanticsLabel,
|
|
),
|
|
);
|
|
}
|
|
}
|