flutter detect pointer device kind

529 Views Asked by At

I want to draw on screen only when the stylus pen device is used and should not detect any finger input in flutter Here is the image

I am using this package https://pub.dev/packages/painter. please help me thanks in advance

1

There are 1 best solutions below

1
Youssef Maouche On

You can use Listener class.

handleTouchEvent(event){

    if (event.kind == PointerDeviceKind.stylus){
      ////
    }

};

Listener(
      onPointerDown:handleTouchEvent ,
      onPointerUp:handleTouchEvent,
      onPointerMove:handleTouchEvent
      child: child,
);