philip-brink / DragAndDropLists

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

Dragging and dropping DragAndDropListExpansion should collapse all DragAndDropListExpansion #65

Open lhengl opened 2 years ago

lhengl commented 2 years ago

As per the title, dragging and dropping DragAndDropListExpansion should collapse all DragAndDropListExpansion. I haven't been able to find a way to do this with the package. All sub lists will be moved with the state that the drag action started. If they were already opened, the items will be moved in its opened state. This makes it hard to actually do the re-ordering especially if the sub list is the size of half or more of the screen.

Is there a workaround to this, or can this please be added as a feature? Thank you.

thaidmfinnick commented 1 year ago

Hi @lhengl, I've met a problem like you. It brings bad experience for user. Screenshot 2023-05-22 at 17 13 51 Any suggestion and how to solve this problem?

Hope @philip-brink will answer! Thankss!

thaidmfinnick commented 1 year ago

I have solution to workaround with this problem:

  1. inside drag_and_drop_list_expansion.dart, author creates 1 generateWidget function to render expansion tile and when dragging, author uses generateWidget with contents to show feedback. That's why expansion tile still opens while dragging.

  2. solution is we will create generateWidgetWithoutChildren, we don't pass contents to this, and we call this method in drag_and_drop_list_wrapper.dart, feedback atrributes we pass generateWidgetWithoutChildren and done!

Screenshot 2023-06-07 at 10 25 51

Screenshot 2023-06-07 at 10 23 16

Screenshot 2023-06-07 at 10 24 40

If you want to see details in my solution, you can consider this fork: https://github.com/thaidmfinnick/DragAndDropLists/blob/master/lib/drag_and_drop_list_expansion.dart