Flutter可拖动和可重新排序ListView



我需要创建一个列表,它应该能够在其中重新排序,但如果拖动到特定的拖动目标,我也应该能够删除项目。现在,我已经在两个不同的屏幕中集成了这两个功能。一个使用ReorderabelListView,另一个使用Draggable。有没有办法把两者结合起来?

您可以使用可重新排序插件

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(),
);

最新更新