Skip to content

Conversation

@Franklyn-R-Silva
Copy link
Contributor

This PR adds scrollBehavior to the RefreshIndicator.noSpinner sample to allow mouse dragging on desktop platforms, addressing the issue where it was impossible to trigger the refresh with a mouse.

Fixes #179711

@flutter-dashboard
Copy link

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.

@github-actions github-actions bot added framework flutter/packages/flutter repository. See also f: labels. d: api docs Issues with https://api.flutter.dev/ d: examples Sample code and demos labels Dec 18, 2025
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a 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.

Copy link
Contributor

@victorsanni victorsanni left a 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.

@Franklyn-R-Silva
Copy link
Contributor Author

Franklyn-R-Silva commented Dec 18, 2025

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 examples/api/test/material/refresh_indicator/refresh_indicator.2_test.dart

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();
  });

Copy link
Contributor

@victorsanni victorsanni left a 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!

Copy link
Member

@hannah-hyj hannah-hyj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@hannah-hyj hannah-hyj added the autosubmit Merge PR when tree becomes green via auto submit App label Dec 18, 2025
@auto-submit auto-submit bot added this pull request to the merge queue Dec 18, 2025
Merged via the queue into flutter:master with commit 0c98a23 Dec 18, 2025
44 checks passed
@flutter-dashboard flutter-dashboard bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Dec 18, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Dec 19, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Dec 19, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Dec 19, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Dec 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

d: api docs Issues with https://api.flutter.dev/ d: examples Sample code and demos framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RefreshIndicator.noSpinner example scrollview does not pull down with mouse pointer on desktop

3 participants