-
Notifications
You must be signed in to change notification settings - Fork 22
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
Add a way to customize sensitivity of swipe-to-dismiss action on modal sheet #162
Comments
Hi @fujidaiti This is added to the latest version of WoltModalSheet. You can check the implementation and maybe create a PR to smooth sheet package for the same functionality? |
Reading the code you mentioned, I can say that we could implement the same feature as wolt_modal_sheet. But I'm currently thinking of a different API, which could look like the following: ModalSheetRoute(
// New API (optional). Specifying null is equivalent to `swipeDismissible: false`.
swipeDismissibility: SwipeDismissibility(
// The minimum required velocity of a fling gesture to dismiss the modal.
flingVelocityThreshold: 500, // pixels/sec
// If the extent (the visible height of the sheet) is smaller than this threshold
// when a drag ends without flinging, the modal will be dismissed.
extentThreshold: const Extent.pixels(100),
),
// swipeDismissible: true, <- Remove the current API to avoid confusion in usage.
builder: (context) => ...,
); This enables precise control over the dismissing behavior of the modal. The current implementation already has similar thresholds, so I think implementing the above API wouldn't be difficult. smooth_sheets/package/lib/src/modal/modal_sheet.dart Lines 10 to 11 in a5d9be1
For reference, here's the current logic that determines if the modal should be dismissed or not. smooth_sheets/package/lib/src/modal/modal_sheet.dart Lines 319 to 333 in a5d9be1
This is just an idea, so suggestions for the proposed API are of course welcome :) |
Discussed in #158
Originally posted by mark8044 June 5, 2024
Right now, compared to most other Sheet packages (including Wolt) this packages pull down sensitivity seems too sensitive for my taste. Meaning its too easy to pull it down to dismiss. It becomes a problem when using a scrollableSheet. Is there an easy way to modify this sensitivity?
Thank you much
The text was updated successfully, but these errors were encountered: