简体   繁体   中英

Flutter Draggable and ReorderableListView

I need to create a list, which should be capable of reordering within but also I should be able to delete an item if dragged to a particular drag target. Right now I have incorporated these two functionalities in two different screens. One using ReorderabelListView and the other using Draggable. Is there a way to combine both?

You can make it by using reorderables plugin

ReorderableColumn(
  onReorder: (oldIndex, newIndex) {

  },
  children: someList.map((item) {
    final index = someList.indexOf(item);

    return Dismissible(
      key: ObjectKey(item),
      onDismissed: (direction) {

      },
      background: Container(color: Colors.red),
      child: Container(),
    );
  }).toList(),
);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM