ReorderableListView constructor

ReorderableListView({
  1. Key? key,
  2. required List<Widget> children,
  3. @Deprecated('Use the onReorderItem callback instead. ' 'The onReorderItem callback adjusts the newIndex parameter for a removed item at the oldIndex. ' 'This feature was deprecated after v3.41.0-0.0.pre.') ReorderCallback? onReorder,
  4. ReorderCallback? onReorderItem,
  5. void onReorderStart(
    1. int index
    )?,
  6. void onReorderEnd(
    1. int index
    )?,
  7. double? itemExtent,
  8. ItemExtentBuilder? itemExtentBuilder,
  9. Widget? prototypeItem,
  10. ReorderItemProxyDecorator? proxyDecorator,
  11. bool buildDefaultDragHandles = true,
  12. EdgeInsets? padding,
  13. Widget? header,
  14. Widget? footer,
  15. Axis scrollDirection = Axis.vertical,
  16. bool reverse = false,
  17. ScrollController? scrollController,
  18. bool? primary,
  19. ScrollPhysics? physics,
  20. bool shrinkWrap = false,
  21. double anchor = 0.0,
  22. @Deprecated('Use scrollCacheExtent instead. ' 'This feature was deprecated after v3.41.0-0.0.pre.') double? cacheExtent,
  23. ScrollCacheExtent? scrollCacheExtent,
  24. DragStartBehavior dragStartBehavior = DragStartBehavior.start,
  25. ScrollViewKeyboardDismissBehavior? keyboardDismissBehavior,
  26. String? restorationId,
  27. Clip clipBehavior = Clip.hardEdge,
  28. double? autoScrollerVelocityScalar,
  29. ReorderDragBoundaryProvider? dragBoundaryProvider,
  30. MouseCursor? mouseCursor,
})

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,
  @Deprecated(
    'Use the onReorderItem callback instead. '
    'The onReorderItem callback adjusts the newIndex parameter for a removed item at the oldIndex. '
    'This feature was deprecated after v3.41.0-0.0.pre.',
  )
  this.onReorder,
  this.onReorderItem,
  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,
  @Deprecated(
    'Use scrollCacheExtent instead. '
    'This feature was deprecated after v3.41.0-0.0.pre.',
  )
  this.cacheExtent,
  this.scrollCacheExtent,
  this.dragStartBehavior = DragStartBehavior.start,
  this.keyboardDismissBehavior,
  this.restorationId,
  this.clipBehavior = Clip.hardEdge,
  this.autoScrollerVelocityScalar,
  this.dragBoundaryProvider,
  this.mouseCursor,
}) : 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.',
     ),
     assert(
       (onReorderItem != null && onReorder == null) ||
           (onReorderItem == null && onReorder != null),
       'The onReorder callback is obsolete and is replaced by onReorderItem. '
       'Remove the onReorder callback when both callbacks are provided.',
     ),
     itemBuilder = ((BuildContext context, int index) => children[index]),
     itemCount = children.length;