SliverVariedExtentList.builder constructor

SliverVariedExtentList.builder({
  1. Key? key,
  2. required NullableIndexedWidgetBuilder itemBuilder,
  3. required ItemExtentBuilder itemExtentBuilder,
  4. ChildIndexGetter? findChildIndexCallback,
  5. int? itemCount,
  6. bool addAutomaticKeepAlives = true,
  7. bool addRepaintBoundaries = true,
  8. bool addSemanticIndexes = true,
})

A sliver that places multiple box children in a linear array along the main axis.

SliverVariedExtentList places its children in a linear array along the main axis starting at offset zero and without gaps. Each child is forced to have the returned extent of itemExtentBuilder in the main axis and the SliverConstraints.crossAxisExtent in the cross axis.

This constructor is appropriate for sliver lists with a large (or infinite) number of children whose extent is already determined.

Providing a non-null itemCount improves the ability of the SliverGrid to estimate the maximum scroll extent.

Implementation

SliverVariedExtentList.builder({
  super.key,
  required NullableIndexedWidgetBuilder itemBuilder,
  required this.itemExtentBuilder,
  ChildIndexGetter? findChildIndexCallback,
  int? itemCount,
  bool addAutomaticKeepAlives = true,
  bool addRepaintBoundaries = true,
  bool addSemanticIndexes = true,
}) : super(delegate: SliverChildBuilderDelegate(
  itemBuilder,
  findChildIndexCallback: findChildIndexCallback,
  childCount: itemCount,
  addAutomaticKeepAlives: addAutomaticKeepAlives,
  addRepaintBoundaries: addRepaintBoundaries,
  addSemanticIndexes: addSemanticIndexes,
));