philip-brink / DragAndDropLists

Flutter package for drag-and-drop reordering of two-level lists
BSD 3-Clause "New" or "Revised" License
253 stars 128 forks source link

Disabling Drag On Long Press does nothing #71

Open ThomJ130 opened 2 years ago

ThomJ130 commented 2 years ago

For DragAndDropLists, having the parameter itemDragOnLongPress set to false does nothing.

Looking at the source code under drag_and_drop_lists.dart, you can search for itemDragOnLongPress and see that it is only initialized, never used.

image

Can this be fixed? Is there a work-around? I need dragging behavior to be immediate.

Pablo-Aldana commented 2 years ago

I have found a "workaround" if you setup listDragOnLongPress=true it will make the magic, but of course would make also the list draggable instead of longPress.

There is another trick you can create a dragHandle with empty container to make just the item draggable

itemDragHandle: const DragHandle(
        child:Container(),
      ),

I did a quick research and the problem seems to be on DragAndDropBuilderParameters class that only has one parameter for this this.dragOnLongPress = true and it is setup by dragOnLongPress: widget.listDragOnLongPress, so it is the list the one setting up this value.

Durai-Bharath commented 3 months ago

To make the dragging behavior to be immediate Go to C:...\AppData\Local\Pub\Cache\hosted\pub.dev\drag_and_drop_lists-0.4.0\lib\drag_and_drop_builder_parameters.dart and change the contructor value of this.dragOnLongPress to false.