处理颤动中的多点触摸 [英] Handling multitouch in flutter

查看:64
本文介绍了处理颤动中的多点触摸的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

flutter 中,有一个标准的 GestureDetector 可以解释命令 向下触摸 触摸移动 向上触摸 >通过相应的处理程序:

In flutter, there is a standard GestureDetector that allows to interprets the commands "touch down", "touch move" and "touch up" by means of the corresponding handlers:


  • onPanStart:_handlePanStart,

  • onPanUpdate:_handlePanUpdate,

  • onPanEnd:_handlePanEnd,

但是,我们正在谈论处理单点触摸,但是如果我想处理几个平行的触摸和动作?即真的使用多点触控吗?颤动中是否有任何内置控件(也许我不知道多点触摸手势检测器)允许获取矢量或单击,移动,带有触摸ID的起伏及其当前坐标的事件列表?

However, we are talking about processing a single touch, but what if I want to handle several parallel touches and movements? I.e. really use multitouch? Is there any kind of built-in control in flutter (maybe multitouch gesture detector, I don't known) that allows to get a vector or a list of events of clicks, movements, ups with ids of touches and their current coordinates?

推荐答案

看起来像您在寻找 MultiDragGestureRecognizer 。查看此线程以了解更多信息。

Looks like you are looking for MultiDragGestureRecognizer. Look into this thread to know more.

编辑:没有直接的小部件可以使用。您需要创建一个实例化MultiDragGestureRecognizer的StatefulWidget,然后使您的构建函数具有一个将onPointerDown事件路由到识别器的侦听器。

Edit : There is no direct widget that you can use. You'll need to create a StatefulWidget that instantiates the MultiDragGestureRecognizer, then have your build function have a Listener that routes the onPointerDown event to the recognizer.

这篇关于处理颤动中的多点触摸的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆