Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ReorderableList and ReorderableListView should have built-in dragTarget props #85244

Open
noxasch opened this issue Jun 24, 2021 · 2 comments
Open
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

Comments

@noxasch
Copy link

noxasch commented Jun 24, 2021

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

  1. ReorderableList and ReorderableListView should have built-in dragTarget props so onAcceptWithDetails and onAccept 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.

  2. Allow ReorderableList items to be drag and reorder without the needs to additional listener on the outside.

@darshankawar darshankawar added in triage Presently being triaged by the triage team f: material design flutter/packages/flutter/material repository. f: scrolling Viewports, list views, slivers, etc. framework flutter/packages/flutter repository. See also f: labels. passed first triage c: proposal A detailed proposal for a change to Flutter c: new feature Nothing broken; request for a new capability and removed in triage Presently being triaged by the triage team labels Jun 25, 2021
@darshankawar
Copy link
Member

Cc: @darrenaustin

@SungHyun22

This comment was marked as outdated.

@Piinks Piinks added the P3 Issues that are less important to the Flutter project label Feb 21, 2023
@flutter-triage-bot flutter-triage-bot bot added multiteam-retriage-candidate team-design Owned by Design Languages team triaged-design Triaged by Design Languages team labels Jul 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Projects
None yet
Development

No branches or pull requests

5 participants