简体   繁体   English

如何在Flutter中用两个手指旋转手势?

[英]How do I do a two-finger rotate gesture in Flutter?

I'm using Flutter for my mobile app. 我正在为我的移动应用程序使用Flutter。 My designer told me to use a "two-finger rotate" gesture for one of our screens. 我的设计师告诉我在其中一个屏幕上使用“两指旋转”手势。 How do I implement this with Flutter? 如何使用Flutter实施此操作?

I hope I'm wrong. 我希望我错了。 But it doesn't seems like this has been implemented yet. 但这似乎尚未实现。

Ideally you should create a RotationGestureRecognizer that extends OneSequenceGestureRecognizer ; 理想情况下,您应该创建一个扩展OneSequenceGestureRecognizerRotationGestureRecognizer which can then be added in GestureDetector (and submit a cool pull request). 然后可以将其添加到GestureDetector (并提交一个很酷的请求)。 You can use ScaleGestureRecognizer as exemple. 您可以将ScaleGestureRecognizer用作ScaleGestureRecognizer

You could also use onPanDown , onPanUpdate and onPanEnd to keep the position of all pointers. 您还可以使用onPanDownonPanUpdateonPanEnd来保留所有指针的位置。 And use the onPanUpdate delta to calculate the rotation. 并使用onPanUpdate delta计算旋转。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM