drag_and_drop_lists

双层拖放可重新排序列表。

特点

  • 在多个列表之间重排元素
  • 重排列表
  • 从列表外部拖放新元素
  • 垂直或水平布局
  • 可展开的列表
  • 可在 slivers 中使用
  • 易于扩展自定义布局

basic

list_tiles

expansion_tiles

slivers

horizontal

drag_into_list

用法

要使用此插件,请将 drag_and_drop_lists 添加到您的 pubspec.yaml 文件中作为 依赖项。
例如

dependencies:
  drag_and_drop_lists: ^0.0.6

现在在您的 Dart 代码中,您可以使用:import 'package:drag_and_drop_lists/drag_and_drop_lists.dart';

要添加列表,请添加一个 DragAndDropLists 小部件。将其子项设置为 DragAndDropList 的列表。同样,将 DragAndDropList 的子项设置为 DragAndDropItem 的列表。
例如

...

  DragAndDropLists(
    children: List.generate(_lists.length, (index) => _buildList(index)),
    onItemReorder: _onItemReorder,
    onListReorder: _onListReorder,
  ),

...

_buildList(int outerIndex) {
  var innerList = _lists[outerIndex];
  return DragAndDropList(
    title: Text('List ${innerList.name}'),
    children: List.generate(innerList.children.length, (index) => _buildItem(innerList.children[index])),
  );
}

_buildItem(String item) {
  return DragAndDropItem(
    child: ListTile(
      title: Text(item),
    ),
  );
}

有关更多示例,请参阅示例应用程序或直接 查看示例代码

GitHub

https://github.com/philip-brink/DragAndDropLists