[英]How to use Draggable and InteractiveViewer together in Flutter
In Flutter, I can use Draggable to drag an object, say an image.在 Flutter 中,我可以使用 Draggable 来拖动一个 object,比如一个图像。 Also, using InteractiveViewer, I can pinch-zoom the same image.
此外,使用 InteractiveViewer,我可以双指缩放同一图像。 Am able to do these actions separately with the individual widgets, but not able to figure out how to do both together -
我能够使用各个小部件分别执行这些操作,但无法弄清楚如何同时执行这两个操作 -
How can I achieve this in Flutter?我怎样才能在 Flutter 中实现这一点?
If you just want to scale an image (zoom in/out), you don't have to use InteractiveViewer
.如果您只想缩放图像(放大/缩小),则不必使用
InteractiveViewer
。 You can use GestureDetector
to do scaling, rotating, and moving, all at once.您可以使用
GestureDetector
同时进行缩放、旋转和移动。
You can check out my answer to a similar question here .您可以在此处查看我对类似问题的回答。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.