Open fujidaiti opened 5 months ago
Here is my current thought on this topic:
It looks like the native sheet in the video is actually being stretched by a user drag. But the sheets from this package only slide up and down, the actual sheet height doesn't change (I think the name StretchingSheetPhysics
is misleading, should be renamed).
The challenge here is that for some technical reasons we can't change the actual height of a sheet along with a drag gesture, so if the sheet is already fully visible but the user keeps dragging it up, it ends up with the bottom of the sheet away from the bottom of the screen, which is not what we want here.
A known workaround is here: https://github.com/fujidaiti/smooth_sheets/discussions/157#discussioncomment-9668540
Thank you @fujidaiti. I think if we can limit the stretch direction like described in #159, the ability to limit the max stretch distance on top with StretchingSheetPhysics(stretchingRange: const Extent.pixels(12))
is enough to have the sheet not invading the top "safe area".
_Originally posted by @habibasseiss in https://github.com/fujidaiti/smooth_sheets/issues/159#issuecomment-2148436779_
I'd love to have max stretch like @appinteractive suggested. In the native sheet, the stretch stops at the reduced parent page limits.
Here's the behavior of a basic sheet in SwiftUI:
https://github.com/fujidaiti/smooth_sheets/assets/521863/c189bc02-c0d0-4956-bc7f-31bbbd063442
Source code: https://gist.github.com/habibasseiss/d14c375c40b6a543a8043d2aedc00c36
Having that in addition to the sheet attaching the bottom would be amazing!