SliverReorderableList constructor

const SliverReorderableList({
  1. Key? key,
  2. required IndexedWidgetBuilder itemBuilder,
  3. ChildIndexGetter? findChildIndexCallback,
  4. required int itemCount,
  5. @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,
  6. ReorderCallback? onReorderItem,
  7. void onReorderStart(
    1. int
    )?,
  8. void onReorderEnd(
    1. int
    )?,
  9. double? itemExtent,
  10. ItemExtentBuilder? itemExtentBuilder,
  11. Widget? prototypeItem,
  12. ReorderItemProxyDecorator? proxyDecorator,
  13. ReorderDragBoundaryProvider? dragBoundaryProvider,
  14. double? autoScrollerVelocityScalar,
})

Creates a sliver list that allows the user to interactively reorder its items.

The itemCount must be greater than or equal to zero.

Implementation

const SliverReorderableList({
  super.key,
  required this.itemBuilder,
  this.findChildIndexCallback,
  required this.itemCount,
  @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.dragBoundaryProvider,
  double? autoScrollerVelocityScalar,
}) : autoScrollerVelocityScalar = autoScrollerVelocityScalar ?? _kDefaultAutoScrollVelocityScalar,
     assert(itemCount >= 0),
     assert(
       (itemExtent == null && prototypeItem == null) ||
           (itemExtent == null && itemExtentBuilder == null) ||
           (prototypeItem == null && itemExtentBuilder == null),
       'You can only pass one of itemExtent, prototypeItem and itemExtentBuilder.',
     ),
     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.',
     );