feat: Add option to allow swipe-down to dismiss #21
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
A ticket asked for swipe-to-dismiss (#14)
It's easy to implement and now supported with the
swipeDismissible
argument.This allows the user to drag the dialog down to dismiss it.
Initially there was a problem when the user zoomed in and tried to pan around on the
zoomed-in image: The
Dismissible
widget's GestureDetector would take over andenter the dismissal animation. Watching the image's scale and then changing the Dismissible's
dismissDirection
fromdown
tonone
solves the issue. However, additionally aGlobalObjectKey
was needed for the PageView because Dismissible changes the location ofthe widget in the widget tree when its
dismissDirection
is changed tonone
.See https://github.com/flutter/flutter/blob/2aa348b9407e96ffe4eca8e8f213c7984afad3f7/packages/flutter/lib/src/widgets/dismissible.dart#L692
See flutter/flutter#108961
See https://www.youtube.com/watch?v=kn0EOS-ZiIc
Type
What kind of change does this pull request introduce?
Breaking Changes
Does this pull request introduce any breaking changes?