ReorderableListView constructor
- Key? key,
- required List<
Widget> children, - required ReorderCallback onReorder,
- void onReorderStart(
- int index
- void onReorderEnd(
- int index
- double? itemExtent,
- ItemExtentBuilder? itemExtentBuilder,
- Widget? prototypeItem,
- ReorderItemProxyDecorator? proxyDecorator,
- bool buildDefaultDragHandles = true,
- EdgeInsets? padding,
- Widget? header,
- Axis scrollDirection = Axis.vertical,
- bool reverse = false,
- ScrollController? scrollController,
- bool? primary,
- ScrollPhysics? physics,
- bool shrinkWrap = false,
- double anchor = 0.0,
- double? cacheExtent,
- DragStartBehavior dragStartBehavior = DragStartBehavior.start,
- ScrollViewKeyboardDismissBehavior keyboardDismissBehavior = ScrollViewKeyboardDismissBehavior.manual,
- String? restorationId,
- Clip clipBehavior = Clip.hardEdge,
- double? autoScrollerVelocityScalar,
Creates a reorderable list from a pre-built list of widgets.
This constructor is appropriate for lists with a small number of children because constructing the List requires doing work for every child that could possibly be displayed in the list view instead of just those children that are actually visible.
See also:
- ReorderableListView.builder, which allows you to build a reorderable list where the items are built as needed when scrolling the list.
Implementation
ReorderableListView({
super.key,
required List<Widget> children,
required this.onReorder,
this.onReorderStart,
this.onReorderEnd,
this.itemExtent,
this.itemExtentBuilder,
this.prototypeItem,
this.proxyDecorator,
this.buildDefaultDragHandles = true,
this.padding,
this.header,
this.footer,
this.scrollDirection = Axis.vertical,
this.reverse = false,
this.scrollController,
this.primary,
this.physics,
this.shrinkWrap = false,
this.anchor = 0.0,
this.cacheExtent,
this.dragStartBehavior = DragStartBehavior.start,
this.keyboardDismissBehavior = ScrollViewKeyboardDismissBehavior.manual,
this.restorationId,
this.clipBehavior = Clip.hardEdge,
this.autoScrollerVelocityScalar,
}) : assert(
(itemExtent == null && prototypeItem == null) ||
(itemExtent == null && itemExtentBuilder == null) ||
(prototypeItem == null && itemExtentBuilder == null),
'You can only pass one of itemExtent, prototypeItem and itemExtentBuilder.',
),
assert(
children.every((Widget w) => w.key != null),
'All children of this widget must have a key.',
),
itemBuilder = ((BuildContext context, int index) => children[index]),
itemCount = children.length;