Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Handling multitouch in flutter

Tags:

flutter

dart

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,

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?

like image 291
Michael Kanzieper Avatar asked Apr 17 '26 04:04

Michael Kanzieper


1 Answers

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

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.

like image 144
Harsh Bhikadia Avatar answered Apr 20 '26 03:04

Harsh Bhikadia



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!