loading state and error handling refactor
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
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),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user