Unverified Commit 300e1df7 authored by Lazy Llama's avatar Lazy Llama Committed by GitHub

Reduce refresh indicator pull-down distance and update related tests (#69783)

Co-authored-by: 's avataraltherat <contact@altherat.com>
parent 2f3cccc4
......@@ -258,7 +258,7 @@ class RefreshIndicatorState extends State<RefreshIndicator> with TickerProviderS
}
} else if (notification is OverscrollNotification) {
if (_mode == _RefreshIndicatorMode.drag || _mode == _RefreshIndicatorMode.armed) {
_dragOffset = _dragOffset! - notification.overscroll / 2.0;
_dragOffset = _dragOffset! - notification.overscroll;
_checkDragOffset(notification.metrics.viewportDimension);
}
} else if (notification is ScrollEndNotification) {
......
......@@ -225,7 +225,7 @@ void main() {
),
);
await tester.fling(find.text('X'), const Offset(0.0, 100.0), 1000.0);
await tester.fling(find.text('X'), const Offset(0.0, 50.0), 1000.0);
await tester.pump();
await tester.pump(const Duration(seconds: 1));
await tester.pump(const Duration(seconds: 1));
......@@ -233,6 +233,33 @@ void main() {
expect(refreshCalled, false);
});
testWidgets('RefreshIndicator - just enough', (WidgetTester tester) async {
refreshCalled = false;
await tester.pumpWidget(
MaterialApp(
home: RefreshIndicator(
onRefresh: refresh,
child: ListView(
physics: const AlwaysScrollableScrollPhysics(),
children: const <Widget>[
SizedBox(
height: 200.0,
child: Text('X'),
),
],
),
),
),
);
await tester.fling(find.text('X'), const Offset(0.0, 100.0), 1000.0);
await tester.pump();
await tester.pump(const Duration(seconds: 1));
await tester.pump(const Duration(seconds: 1));
await tester.pump(const Duration(seconds: 1));
expect(refreshCalled, true);
});
testWidgets('RefreshIndicator - show - slow', (WidgetTester tester) async {
refreshCalled = false;
await tester.pumpWidget(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment