Skip to content
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: Press-and-hold gesture in PageView doesn't stop momentum scrolling #219

Merged
merged 5 commits into from
Aug 18, 2024

Conversation

fujidaiti
Copy link
Owner

@fujidaiti fujidaiti commented Aug 18, 2024

Fixes / Closes (optional)

Fixes #214.

Description

This PR adds holdWithScrollPosition() to ScrollableSheetExtent to handle press-and-hold gestures in scrollable sheet content. It starts a HoldScrollDrivenSheetActivity, which stops momentum scrolling (if it is running).

The absence of this handling logic hasn't been problematic for simple ListViews or PageViews with only one page. This is because the SDK triggers ScrollPosition.drag() immediately after calling ScrollPosition.hold() when the user performs a press-and-hold gesture. However, in a PageView with multiple ListViews, drag() won't be called after hold() until the user actually moves their finger.

Summary (check all that apply)

  • Modified / added code
  • Modified / added tests
  • Modified / added examples
  • Modified / added others (pubspec.yaml, workflows, etc...)
  • Updated README
  • Contains breaking changes
    • Created / updated migration guide
  • Incremented version number
    • Updated CHANGELOG

@fujidaiti fujidaiti self-assigned this Aug 18, 2024
@fujidaiti fujidaiti marked this pull request as ready for review August 18, 2024 17:27
@fujidaiti fujidaiti merged commit d33931f into main Aug 18, 2024
7 checks passed
@fujidaiti fujidaiti deleted the pageview-issue branch August 18, 2024 17:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ScrollableSheet with PageView and two pages don't stop momentum when holding the scrollable
1 participant