-
Notifications
You must be signed in to change notification settings - Fork 29.7k
fix: Enable mouse drag for RefreshIndicator.noSpinner example #180066
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Enable mouse drag for RefreshIndicator.noSpinner example #180066
Conversation
|
It looks like this pull request may not have tests. Please make sure to add tests or get an explicit test exemption before merging. If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix? Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. If you believe this PR qualifies for a test exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!). The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request enables mouse dragging for the RefreshIndicator.noSpinner example by setting a custom scrollBehavior on the MaterialApp. The change correctly addresses the issue. I've provided a few suggestions to improve code clarity and robustness, such as removing a redundant import and temporary comments, and using a more future-proof way to specify the drag devices.
examples/api/lib/material/refresh_indicator/refresh_indicator.2.dart
Outdated
Show resolved
Hide resolved
examples/api/lib/material/refresh_indicator/refresh_indicator.2.dart
Outdated
Show resolved
Hide resolved
victorsanni
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this PR. It will need a test to land.
Thank you for the feedback! I have just updated the PR to include a new widget test in testWidgets('Pulling with mouse pointer triggers a refresh indicator', (
WidgetTester tester,
) async {
await tester.pumpWidget(const example.RefreshIndicatorExampleApp());
// Simulate a mouse drag gesture to trigger the refresh.
final TestGesture gesture = await tester.startGesture(
tester.getCenter(find.text('Pull down here').first),
kind: PointerDeviceKind.mouse,
);
await gesture.moveBy(const Offset(0.0, 300.0));
await tester.pump();
await gesture.up();
await tester.pump();
await tester.pump(const Duration(seconds: 1));
await tester.pump(const Duration(seconds: 1));
expect(
find.bySemanticsLabel('Circular progress indicator'),
findsOneWidget,
);
await tester.pumpAndSettle();
}); |
victorsanni
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the fix!
hannah-hyj
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This PR adds
scrollBehaviorto theRefreshIndicator.noSpinnersample to allow mouse dragging on desktop platforms, addressing the issue where it was impossible to trigger the refresh with a mouse.Fixes #179711