I am trying to build a section list view with drag and drop functionality across sections. Is it possible to do this using Flutter widget.
I tried using ReorderableListView which works fine for drag and drop. But I also want to introduce sections inside my list view. so I tried using ExpansionTile instead of ListTile inside ReorderableListView. but it doesn't seems to be working. Any thoughts on how to implement this.
class _ItemListWidgetState extends State<ItemListWidget> {
@override
Widget build(BuildContext context) {
/// iterating through the list items from the store and displaying in a listView.
return ReorderableListView(
header: Text('Sample Header'),
children: widget.model.items.map((Item item) => ListTile(
key: ObjectKey(item),
title: Text(item.body),
leading: Checkbox(value: item.completed, onChanged: (b) {
widget.model.onCompleted(item);
}),
trailing: IconButton(
icon: Icon(Icons.more_horiz),
onPressed: () => _itemsModalBottomSheet(context, () => widget.model.onRemoveItem(item)),
),
)).toList(),
onReorder: widget.model.onReorderItem,
);
}
}
The above code works fine for drag and drop but not sure on how to introduce section instead of showing one simple list.