drag and drop_lists
two-level drag and drop reorderable lists.
features
- reorder elements between multiple lists
- 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.6
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.
Comments are closed.