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 Hero animation when drag-dismissing WoltModalSheet at zero threshold #368

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ArinFaraj
Copy link

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:

  • Added minimum threshold check in vertical and horizontal drag update handlers
  • Ensures consistent Hero widget behavior across all dismissal scenarios

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.

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • My PR includes tests for all changed/updated/fixed behaviors.
  • All existing and new tests are passing.
  • I updated/added relevant documentation (doc comments with ///).
  • The analyzer (melos run analyze) does not report any problems on my PR.
  • The package compiles with the minimum Flutter version stated in the pubspec.yaml

Breaking Change

Does your PR require plugin users to manually update their apps to accommodate your change?

  • Yes, this is a breaking change.
  • No, this is not a breaking change.

- 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
@ulusoyca
Copy link
Collaborator

ulusoyca commented Mar 3, 2025

@TahaTesser Do you think you may have time to check this?

@TahaTesser TahaTesser self-requested a review March 3, 2025 14:01
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.

2 participants