fix(flutter): 修复下拉刷新页面跟随
This commit is contained in:
1 parent
c4dcb714ab
commit
69eaacd74f
16 files changed
+85
-34
No files matched your search
@@ -26,7 +26,7 @@ void main() {
|
||||
},
|
||||
child: ListView(
|
||||
key: const Key('pull-refresh-list'),
|
||||
physics: const AlwaysScrollableScrollPhysics(),
|
||||
physics: AppPullToRefresh.physics,
|
||||
children: const [SizedBox(height: 1200)],
|
||||
),
|
||||
),
|
||||
@@ -34,14 +34,17 @@ void main() {
|
||||
),
|
||||
);
|
||||
|
||||
final gesture = await tester.startGesture(
|
||||
tester.getCenter(find.byKey(const Key('pull-refresh-list'))),
|
||||
);
|
||||
final list = find.byKey(const Key('pull-refresh-list'));
|
||||
final gesture = await tester.startGesture(tester.getCenter(list));
|
||||
await gesture.moveBy(const Offset(0, 30));
|
||||
await tester.pump();
|
||||
final scrollable = tester.state<ScrollableState>(
|
||||
find.descendant(of: list, matching: find.byType(Scrollable)).first,
|
||||
);
|
||||
expect(scrollable.position.pixels, lessThan(0));
|
||||
expect(find.text('Pull to refresh'), findsOneWidget);
|
||||
|
||||
await gesture.moveBy(const Offset(0, 40));
|
||||
await gesture.moveBy(const Offset(0, 120));
|
||||
await tester.pump();
|
||||
expect(find.text('Release to refresh'), findsOneWidget);
|
||||
|
||||
|
||||
Reference in new issue
Block a user