我遇到了以下问题:我的库 easy_image_viewer
有一个请求添加滑动到dismiss的请求。我使用 diver -Code
小部件实现了它。但是,当用户放大图像时,我注意到我必须找到一种“停用”可被关闭的小部件的方法,因为否则用户无法在缩放映像上徘徊。我通过使用 setState
和 divionDirection
变量来解决该问题,可以是 none
或 down
。
现在,对于怪异的部分:每当我调用 setState
和 divionDirection
更改时,页面浏览量就会跳回第一个项目。我已经尝试使用自动keepapaliveclientmixin
,但无济于事。
代码可以在此处找到:
只需运行应用程序( example/lib/main.dart
),点击显示多个图像(Simple)
,滑动到第二张图像并使用Pinch&amp ;缩放以缩放。您会注意到它跳回第一个图像。我在做什么错?
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?
发布评论
评论(1)
您可以使用
confircondismiss
我打开了一个PR,我打开了一个PR,我打开了一个PR,供您检查在这里Instead of changing the dismiss direction you can use
confirmDismiss
i opened a PR for you to check here