-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Fixes the issue of not being able to stop scrolling by dragging the content again #133750
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
Fixes the issue of not being able to stop scrolling by dragging the content again #133750
Conversation
|
It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat (don't just cc him here, he won't see it! He's on Discord!). 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. |
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
392479a to
a9347d4
Compare
Piinks
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.
Hi @intonarumori thanks for contributing! This change will need tests to verify that it works as expected. Thank you!
|
@Piinks Thanks for taking a look. For tests my first idea was to look into the flutter/packages/flutter/lib/src/widgets/scrollable.dart Lines 1693 to 1695 in e7058f5
If you can give me some hints of how to go about testing this I would be happy to look into it. |
|
@intonarumori @Piinks any movement on this? Such a critical feature/bug fix. Does this also allow to scroll again to keep momentum / accelerate like in a regular scrollview? Thanks |
Piinks
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 your patience. I appreciate you taking on a complex fix!
| expect(scrollable.widget.dragStartBehavior, DragStartBehavior.down); | ||
| }, variant: TargetPlatformVariant.all()); | ||
|
|
||
| testWidgets('Fling and tap to stop', (WidgetTester tester) async { |
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.
Can you update these tests to check two more things? These should verify they we are actually scrolling when these taps occur. Can you add the following:
- check the ScrollActivity.velocity in both axes when the test is about to tap and after.
- the activity is available through the ScrollPosition
- verifies we went from scrolling to stopping in response
- we should also verify the position is actually changing/stops changing as a result of flinging and then stopping it with a tap.
- verify the ScrollPosition.pixels before flinging, before tapping, and after tapping
| case DiagonalDragBehavior.weightedContinuous: | ||
| case DiagonalDragBehavior.free: | ||
| verticalScrollable._handleDragEnd(verticalDragDetails); | ||
| //verticalScrollable._handleDragEnd(verticalDragDetails); |
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.
Should this be removed?
| // TwoDimensionalScrollableState. | ||
| return _configuration.buildOverscrollIndicator(context, child, details); | ||
| } | ||
| class _TwoDimensionalDragForwarding { |
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.
Public docs are not required for private classes (///), but can you add some docs to this for maintainers to better understand what it's for and where ti is used?
Piinks
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.
Hey @intonarumori are you planning to return to this and address the feedback above?
|
almost there! |
|
We have not heard back from @intonarumori on this, so I am going to close it and open a new PR so we can close this bug. Thanks for contributing! |
|
@Piinks sounds good thanks. oh hey, nice video btw on this very feature :) |
@Piinks Sorry for the late reply, I've been bogged down by work lately and didn't have the time to come back to this. |
Adopted from #133750 That PR was abandoned. This finishes it up so we can land it. Fixes #133529 Moves the `PanGestureRecognizer` used to drag the content along both axis to the outer vertical `Scrollable` subclass instead of the inner horizontal `Scrollable` subclass. - This solves the issue of the inner `Scrollable` gestures being disabled while the outer `Scrollable` is scrolling - Enables the user to stop the scroll movement by dragging the content again
Moves the
PanGestureRecognizerused to drag the content along both axis to the outerScrollablesubclass.Scrollablegestures being disabled while the outerScrollableis scrollingFixes: #133529
Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on [Discord].