Keep indeterminate RefreshProgressIndicator spinning until end of time (#18010)
This commit is contained in:
parent
921695cc44
commit
a2d1d27f79
@ -528,8 +528,8 @@ class _RefreshProgressIndicatorState extends _CircularProgressIndicatorState {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
if (widget.value != null)
|
if (widget.value != null)
|
||||||
_controller.value = widget.value / 10.0;
|
_controller.value = widget.value / 10.0;
|
||||||
else
|
else if (!_controller.isAnimating)
|
||||||
_controller.forward();
|
_controller.repeat();
|
||||||
return _buildAnimation();
|
return _buildAnimation();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -206,4 +206,30 @@ void main() {
|
|||||||
expect(find.byType(CircularProgressIndicator), paints..arc(strokeWidth: 16.0));
|
expect(find.byType(CircularProgressIndicator), paints..arc(strokeWidth: 16.0));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
testWidgets('Indeterminate RefreshProgressIndicator keeps spinning until end of time (approximate)', (WidgetTester tester) async {
|
||||||
|
// Regression test for https://github.com/flutter/flutter/issues/13782
|
||||||
|
|
||||||
|
await tester.pumpWidget(
|
||||||
|
const Directionality(
|
||||||
|
textDirection: TextDirection.ltr,
|
||||||
|
child: const Center(
|
||||||
|
child: const SizedBox(
|
||||||
|
width: 200.0,
|
||||||
|
child: const RefreshProgressIndicator(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
expect(tester.hasRunningAnimations, isTrue);
|
||||||
|
|
||||||
|
await tester.pump(const Duration(milliseconds: 6666));
|
||||||
|
expect(tester.hasRunningAnimations, isTrue);
|
||||||
|
|
||||||
|
await tester.pump(const Duration(milliseconds: 1));
|
||||||
|
expect(tester.hasRunningAnimations, isTrue);
|
||||||
|
|
||||||
|
await tester.pump(const Duration(days: 9999));
|
||||||
|
expect(tester.hasRunningAnimations, isTrue);
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user