ListView.custom constructor
- Key? key,
- Axis scrollDirection = Axis.vertical,
- bool reverse = false,
- ScrollController? controller,
- bool? primary,
- ScrollPhysics? physics,
- bool shrinkWrap = false,
- EdgeInsetsGeometry? padding,
- double? itemExtent,
- Widget? prototypeItem,
- ItemExtentBuilder? itemExtentBuilder,
- required SliverChildDelegate childrenDelegate,
- double? cacheExtent,
- int? semanticChildCount,
- DragStartBehavior dragStartBehavior = DragStartBehavior.start,
- ScrollViewKeyboardDismissBehavior keyboardDismissBehavior = ScrollViewKeyboardDismissBehavior.manual,
- String? restorationId,
- Clip clipBehavior = Clip.hardEdge,
- HitTestBehavior hitTestBehavior = HitTestBehavior.opaque,
Creates a scrollable, linear array of widgets with a custom child model.
For example, a custom child model can control the algorithm used to estimate the size of children that are not actually visible.
This example shows a ListView that uses a custom SliverChildBuilderDelegate to support child
reordering.
link
To create a local project with this code sample, run:
flutter create --sample=widgets.ListView.custom.1 mysample
Implementation
const ListView.custom({
super.key,
super.scrollDirection,
super.reverse,
super.controller,
super.primary,
super.physics,
super.shrinkWrap,
super.padding,
this.itemExtent,
this.prototypeItem,
this.itemExtentBuilder,
required this.childrenDelegate,
super.cacheExtent,
super.semanticChildCount,
super.dragStartBehavior,
super.keyboardDismissBehavior,
super.restorationId,
super.clipBehavior,
super.hitTestBehavior,
}) : assert(
(itemExtent == null && prototypeItem == null) ||
(itemExtent == null && itemExtentBuilder == null) ||
(prototypeItem == null && itemExtentBuilder == null),
'You can only pass one of itemExtent, prototypeItem and itemExtentBuilder.',
);