我正在尝试使我的列表可重新排序,我已经遵循了一些关于使用 ReorderableListView 的教程,但它不适用于我正在使用的列表类型。我该怎么办?
ReorderableListView 之前的代码
body: ListView.builder(
itemCount: db.toDoList.length,
itemBuilder: (context, index) {
return toDoTile(
taskName: db.toDoList[index][0],
taskCompleted: db.toDoList[index][1],
onChanged: (value) => checkBoxChanged(value, index),
deleteFunction: (context) => deleteTask(index),
editTask: (context) => editTask(index),
);
在 ReorderableListView 上做教程时,我最终得到这个:
body: ReorderableListView(
children: [
for (final tile in myTiles)
ListTile(
key: ValueKey(tile),
title: Text(tile),
)
],
onReorder: (oldIndex, newIndex) => updatMyTiles(oldIndex, newIndex),
),
但问题是我如何将两者一起实施?