Search code examples
flutterdartdraggable

How to prevent many Draggable's feedback with two or more fingers?


I am using the Draggable Widget, however what I want is that only one feedback widget is shown with one finger, because if you do it with several fingers many more appear, but I don't want that, any idea ?

EXAMPLE :

enter image description here enter image description here

CODE EXAMPLE :

Widget build(BuildContext context) {
    return Scaffold(
      body: Draggable(
        /// Show the point to draw
        feedback: Icon(
          Icons.my_location_outlined,
          color: Colors.black,
          size: Theme.of(context).iconTheme.size!,
        ),

        ///
        data: "",

        ///
        dragAnchorStrategy: (draggable, context, position) =>
            const Offset(0, 80),

        child: Center(
          child: Container(
            height: 100,
            width: 100,
            color: Colors.red,
          ),
        ),
      ),
      appBar: AppBar(
        title: const Text('AppBar Example'),
      ),
    );
}

Solution

  • You should add the maxSimultaneousDrags attribute to 1 to limit the number of simultaneous drag