minor operation progress UI change

This commit is contained in:
Thibault Deckers 2021-07-30 11:17:21 +09:00
parent 104a0878c9
commit aa577c8bc6

View file

@ -72,6 +72,9 @@ class _ReportOverlayState<T> extends State<ReportOverlay<T>> with SingleTickerPr
Stream<T> get opStream => widget.opStream; Stream<T> get opStream => widget.opStream;
static const radius = 160.0;
static const strokeWidth = 16.0;
@override @override
void initState() { void initState() {
super.initState(); super.initState();
@ -104,6 +107,7 @@ class _ReportOverlayState<T> extends State<ReportOverlay<T>> with SingleTickerPr
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final progressColor = Theme.of(context).accentColor;
return AbsorbPointer( return AbsorbPointer(
child: StreamBuilder<T>( child: StreamBuilder<T>(
stream: opStream, stream: opStream,
@ -124,20 +128,34 @@ class _ReportOverlayState<T> extends State<ReportOverlay<T>> with SingleTickerPr
), ),
), ),
child: Center( child: Center(
child: CircularPercentIndicator( child: Stack(
children: [
Container(
width: radius,
height: radius,
padding: const EdgeInsets.all(strokeWidth / 2),
child: CircularProgressIndicator(
color: progressColor.withOpacity(.1),
strokeWidth: strokeWidth,
),
),
CircularPercentIndicator(
percent: percent, percent: percent,
lineWidth: 16, lineWidth: strokeWidth,
radius: 160, radius: radius,
backgroundColor: Colors.white24, backgroundColor: Colors.white24,
progressColor: Theme.of(context).accentColor, progressColor: progressColor,
animation: true, animation: true,
center: Text(NumberFormat.percentPattern().format(percent)), center: Text(NumberFormat.percentPattern().format(percent)),
animateFromLastPercent: true, animateFromLastPercent: true,
), ),
],
),
), ),
), ),
); );
}), },
),
); );
} }
} }