Closed fujidaiti closed 1 week ago
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.
For reference, here's the current logic that determines if the modal should be dismissed or not.
This is just an idea, so suggestions for the proposed API are of course welcome :)
Discussed in https://github.com/fujidaiti/smooth_sheets/discussions/158