ReorderableList and ReorderableListView should have built-in dragTarget props #85244
Labels
c: new feature
Nothing broken; request for a new capability
c: proposal
A detailed proposal for a change to Flutter
f: material design
flutter/packages/flutter/material repository.
f: scrolling
Viewports, list views, slivers, etc.
framework
flutter/packages/flutter repository. See also f: labels.
P3
Issues that are less important to the Flutter project
team-design
Owned by Design Languages team
triaged-design
Triaged by Design Languages team
Use case
Eg: Kanban like board, we can drag item from a column to another at specific position (index).
My current workaround is to wrap ReorderableList with dragTarget. I use ListTile as the child widgets, I wrap the listTile with Draggable and then the trailing icon with
ReorderableDragStartListener
. This allow both reorder item inside the ReorderableList and drag into another ReorderableList. This solve the conflict whether i want to reorder or drag it ouside.However when i drop into a ReorderableList as dragTarget, i can only insert at fixed index (eg: index 0) to not lose track of the item in case the list is longer. This is mostly useful on desktop and web.
Proposal
ReorderableList and ReorderableListView should have built-in dragTarget props so
onAcceptWithDetails
andonAccept
can work with the ReorderableList internal to track the index and reorder it accordingly.Looking at the source code Reorderable list internally check the offset via the item index. Hence it should be able do the
opposite internally, when combined with DragTargetDetails we should be able to get the index of the item above and
below current drop position, so we can insert the dragged item at the index it was dropped.
Allow ReorderableList items to be drag and reorder without the needs to additional listener on the outside.
The text was updated successfully, but these errors were encountered: