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

Is there an easy way to do a swipe to dismiss like the twitter app? #14

Closed
mark8044 opened this issue May 15, 2022 · 4 comments
Closed
Labels
enhancement New feature or request

Comments

@mark8044
Copy link

As the title says, is there a good way to allow us to swipe the image up or down (but not diagonally) to dismiss the image?

jfahrenkrug added a commit that referenced this issue May 16, 2022
An ticket asked for swipe-to-dismiss (#14)
It's easy to implement and now supported with the `swipeDismissable` argument.
This allows the user to drag the dialog down to dismiss it.
However, this is still WIP because when the user has zoomed in, you can't pan the
image anymore because the Dismissable widget begins to dismiss. Will have to address
this in a future commit.
@jfahrenkrug
Copy link
Collaborator

Hi @mark8044. Great question. I started the work on this in this commit: 65dbce7 It uses the Dismissible widget. It works well when the user hasn't zoomed in, but I still need to solve the issue of disabling dismissal when the user has zoomed in and wants to pan instead of dismiss.

@jfahrenkrug jfahrenkrug added the enhancement New feature or request label May 19, 2022
@jfahrenkrug
Copy link
Collaborator

I got stuck on a problem with the PageView/PageController. I filed an issue here: flutter/flutter#106708 and asked a question here: https://stackoverflow.com/questions/72779464/flutter-pageview-seems-to-ignore-pagecontrollers-page-property-after-setstate I hope it can be solved.

@jfahrenkrug
Copy link
Collaborator

@mark8044 I've filed another issue here: flutter/flutter#108961

jfahrenkrug added a commit that referenced this issue Aug 4, 2022
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 and
enter the dismissal animation. Watching the image's scale and then changing the Dismissible's
`dismissDirection` from `down` to `none` solves the issue. However, additionally a
`GlobalObjectKey` was needed for the PageView because Dismissible changes the location of
the widget in the widget tree when its `dismissDirection` is changed to `none`.

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

Found a solution: #21
Some background: flutter/flutter#108961 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants