36 lines
941 B
Dart
36 lines
941 B
Dart
import 'package:flutter/material.dart';
|
|
|
|
class AppProgressIndicator extends StatelessWidget {
|
|
final double size;
|
|
final double strokeWidth;
|
|
final Color? color;
|
|
|
|
const AppProgressIndicator._({
|
|
required this.size,
|
|
required this.strokeWidth,
|
|
this.color,
|
|
});
|
|
|
|
const AppProgressIndicator.small({Color? color})
|
|
: this._(size: 16, strokeWidth: 2, color: color);
|
|
|
|
const AppProgressIndicator.medium({Color? color})
|
|
: this._(size: 24, strokeWidth: 2.5, color: color);
|
|
|
|
const AppProgressIndicator.large({Color? color})
|
|
: this._(size: 40, strokeWidth: 3, color: color);
|
|
|
|
@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),
|
|
),
|
|
);
|
|
}
|
|
}
|