-1

I'm having the following problem: My library easy_image_viewer has a request to add swipe-to-dismiss. I implemented it using the Dismissible widget. However, when the user zooms in on an image, I noticed I had to find a way to "deactivate" the Dismissible widget because otherwise the user can't pan around on the zoomed-in image. I solved that by using setState and a dismissDirection variable on the state that can be either none or down. Now for the weird part: Whenever I call setState and the dismissDirection changes, the PageView jumps back to the first item. I've tried using AutomaticKeepAliveClientMixin, but to no avail.

The code can be found here: https://github.com/thesmythgroup/easy_image_viewer/tree/pagecontroller_problem_demo

Simply run the app (example/lib/main.dart), tap on Show Multiple Images (Simple), swipe to the second image and use pinch & zoom to zoom in. You'll notice it jumps back to the first image. What am I doing wrong?

Johannes Fahrenkrug
  • 42,912
  • 19
  • 126
  • 165

1 Answers1

0

Instead of changing the dismiss direction you can use confirmDismiss i opened a PR for you to check here

Mathiew Abbas
  • 823
  • 1
  • 8
  • 17