drag_and_drop_lists

Two-level drag and drop reorderable lists.

Features

  • Reorder elements within a single list
  • Reorder lists
  • Drag and drop new elements from outside of the lists
  • Vertical or horizontal layout
  • Expandable lists
  • Can be used in slivers
  • Easy to extend with custom layouts

Usage

To use this plugin, add drag_and_drop_lists as a dependency in your pubspec.yaml file. For example:

dependencies:
  drag_and_drop_lists: ^0.0.4

Now in your Dart code, you can use: import 'package:drag_and_drop_lists/drag_and_drop_lists.dart';

To add the lists, add a DragAndDropLists widget. Set its children to a list of DragAndDropList. Likewise, set the children of DragAndDropList to a list of DragAndDropItem. For example:

...

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

For further examples, see the example app or view the example code directly.

Libraries

drag_and_drop_builder_parameters
drag_and_drop_interface
drag_and_drop_item
drag_and_drop_item_target
drag_and_drop_item_wrapper
drag_and_drop_list
drag_and_drop_list_expansion
drag_and_drop_list_interface
drag_and_drop_list_target
drag_and_drop_list_wrapper
drag_and_drop_lists
Drag and drop list reordering for two level lists. [...]
programmatic_expansion_tile