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 :
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'),
),
);
}
CodePudding user response:
You should add the maxSimultaneousDrags
attribute to 1
to limit the number of simultaneous drag
CodePudding user response:
You can use the maxSimultaneousDrags
property provided by the Draggable widget.
If it's null then there is no limit to the no of drags that is why you are seeing multiple dragged widget. Set this to 1 if you want to only allow the drag source to have one item dragged at a time. Set this to 0 if you want to prevent the draggable from actually being dragged.