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

Enable drag to dismiss modal if the scroll position is at top edge #283

Merged
merged 4 commits into from
Aug 1, 2024

Conversation

AcarFurkan
Copy link
Collaborator

@AcarFurkan AcarFurkan commented Jul 31, 2024

Description

In the existing implementation, modals with lengthy, scrollable content could only be dismissed using the drag gesture on the drag handle at top.

With the changes introduced in this PR, modals can now be dismissed by initiating a drag on anywhere in the page content in the permitted dismiss direction, as specified by the modal type configuration. This is possible only when the modal's scroll position is at the top (scroll position at 0).

Before After
Simulator.Screen.Recording.-.iPhone.15.Pro.-.2024-07-31.at.18.59.08.mp4
Simulator.Screen.Recording.-.iPhone.15.Pro.-.2024-07-31.at.19.00.18.mp4

This not only works for bottom sheet but also works on all custom modals considering their dismiss direction. Here is the example:

drag_to_close_custom_modal.mov

Related Issues

#262

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.

@ulusoyca
Copy link
Collaborator

@AcarFurkan Thanks for the great solution! I found a cleaner way to achieve the same. What do you think?

@ulusoyca ulusoyca marked this pull request as ready for review July 31, 2024 21:51
@ulusoyca ulusoyca force-pushed the add-draggability-to-content branch from e2cba3d to e018bf5 Compare July 31, 2024 21:55
@ulusoyca ulusoyca force-pushed the add-draggability-to-content branch from e018bf5 to 6680510 Compare July 31, 2024 21:56
@ulusoyca ulusoyca changed the title Draft: add draggability to content Enable drag to dismiss modal if the scroll position is at top edge Jul 31, 2024
@ulusoyca ulusoyca requested a review from TahaTesser July 31, 2024 22:33
@ulusoyca ulusoyca merged commit 53d8bc4 into woltapp:main Aug 1, 2024
3 checks passed
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.

3 participants