ExpandableReorderableList<K extends Key> class

An expandable reorderable list.

If onReorder is specified, it builds a ReorderableListView, if not, it builds a ListView.


This example, inspired by the ReorderableListView documentation, creates a list using ExpandableReorderableList:

 final List<int> _items = List<int>.generate(50, (index) => index);

 @override
 Widget build(BuildContext context) {
   final colorScheme = Theme.of(context).colorScheme;
   final oddItemColor = colorScheme.primary.withOpacity(0.05);
   final evenItemColor = colorScheme.primary.withOpacity(0.15);
   return ExpandableReorderableList<ValueKey<int>>(
     onReorder: (onReorderParam) {
       setState(() {
         var newIndex = onReorderParam.newIndex;
         if (onReorderParam.oldIndex < onReorderParam.newIndex) {
           newIndex -= 1;
         }
         final int item = _items.removeAt(onReorderParam.oldIndex);
         _items.insert(newIndex, item);
       });
     },
     children: _items.map((int item) {
       return ExpandableReorderableListItem<ValueKey<int>>(
         key: ValueKey<int>(item),
         builder: (_, child, model) {
           return ReorderableDragStartListener(
             index: model.index!,
             child: ListTile(
               title: Text('Item $item'),
               tileColor: item.isOdd ? oddItemColor : evenItemColor,
             ),
           );
         },
       );
     }).toList(),
   );
 }
Inheritance

Constructors

ExpandableReorderableList({List<Widget> leads = const <Widget>[], List<Widget> tails = const <Widget>[], List<ExpandableReorderableListItem<K>>? children, OnReorder<K>? onReorder, ScrollController? scrollController, VisibilityController<K>? visibilityController, ExpandableReorderableListItemModelController<K>? modelsController, Axis scrollDirection = Axis.vertical, Key? key})
An expandable reorderable list.

Properties

children List<ExpandableReorderableListItem<K>>
Children of the ExpandableReorderableList.
final
hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
leads List<Widget>
Leading widgets that cannot be reordered. They are always visible.
final
modelsController ExpandableReorderableListItemModelController<K>?
The model controller.
final
onReorder OnReorder<K>?
A callback used by the list to report that a list item has been dragged and dropped to a new location in the list and the application should update the order of the items.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
scrollController ScrollController?
Scroll Controller.
final
scrollDirection Axis
The Axis along which the scroll view's offset increases.
final
tails List<Widget>
Trailing widgets that cannot be reordered. They are always visible.
final
visibilityController VisibilityController<K>?
The visibility controller.
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() → _ExpandableReorderableListState<K>
Creates the mutable state for this widget at a given location in the tree.
override
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A short, textual description of this widget.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited