前面我们对于 ListView
的操作讲过 Flutter 滑动删除最佳实践,那现在我们来了解一下 ListView
的拖拽排序。
效果如下:
ReorderableListView
想要达到如上效果,需使用该类,官网简介:
A list whose items the user can interactively reorder by dragging.
This class is appropriate for views with a small number of children because constructing the List[1] requires doing work for every child that could possibly be displayed in the list view instead of just those children that are actually visible.
All children[2] must have a key.
简单翻译如下: