-
Notifications
You must be signed in to change notification settings - Fork 72
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 Hero animation when drag-dismissing WoltModalSheet at zero threshold #368
base: main
Are you sure you want to change the base?
Conversation
- Refactor drag handling logic for vertical and horizontal dismissals - Add minimum value check to prevent unintended dismissals - Use pattern matching for vertical drag direction - Ensure consistent animation controller value updates
@TahaTesser Do you think you may have time to check this? |
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.
Thank you for contributing!
Introducing a threshold might make sense with more information.
Previously, when dragging the sheet to a position very close to zero and releasing, the Hero widgets on the underlying route would not animate back correctly, while they worked fine when drag-dismissing from halfway or using fling gestures.
Could you please share a code sample to reproduce this behavior? It would be great in the context of this fix. I can reproduce the described behavior with a sample and write tests to verify that this fix is consistent.
Thank you for your time, I have updated the pr with a code sample and a video of the issue |
Thanks so much for the code sample and demo video. I've tried both iOS, Android, and macOS desktop. I couldn't reproduce the failed |
Since i can reproduce it in a new flutter project with the latest flutter version and package version, here are the steps to reproduce:
|
Following these steps, Hero widget always appear in my sample reproduction. I couldn't get the blank button like show in your demo. External.Device.mp4 |
Description
Fixes an issue where Hero widgets fail to animate properly when drag-dismissing a WoltModalSheet that reaches a near-zero position. Previously, when dragging the sheet to a position very close to zero and releasing, the Hero widgets on the underlying route would not animate back correctly, while they worked fine when drag-dismissing from halfway or using fling gestures.
The fix prevents the animation controller from reaching a fully dismissed state during drag operations by implementing a minimum threshold of 0.01. This ensures the proper dismissal sequence is always followed, allowing Hero widgets to complete their transitions correctly.
Changes:
Sample Code
Sample video
Recording.2025-03-04.212803.mp4
Related Issues
Replace this paragraph with a list of issues related to this PR from the issue database. Indicate, which of these issues are resolved or fixed by this PR.
Checklist
Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]
).This will ensure a smooth and quick review process.
///
).melos run analyze
) does not report any problems on my PR.Breaking Change
Does your PR require plugin users to manually update their apps to accommodate your change?