GetSliverList.builder constructor
- required GetItemBuilder itemBuilder,
- List? items,
- IndexedWidgetBuilder? dividerBuilder,
- WidgetBuilder? edgeDividerBuilder,
- WidgetBuilder? headerBuilder,
- GetSectionBuilder? sectionBuilder,
- GetSection? section,
- int? itemCount,
- DividerStyle? divider,
- DividerStyle edgeDivider = DividerStyle.full,
- EdgeInsetsGeometry? padding,
- bool addAutomaticKeepAlives = true,
- bool addRepaintBoundaries = true,
- bool addSemanticIndexes = true,
- Axis scrollDirection = Axis.vertical,
- Key? key,
Creates a fixed-length scrollable linear array of list "items" separated by list item "separators".
This constructor is appropriate for list views with a large number of item and separator children because the builders are only called for the children that are actually visible.
The itemBuilder
callback will be called with indices greater than
or equal to zero and less than itemCount
.
Separators only appear between list items: separator 0 appears after item 0 and the last separator appears before the last item.
The separatorBuilder
callback will be called with indices greater than
or equal to zero and less than itemCount
.
The itemBuilder
and separatorBuilder
callbacks should always return a
non-null widget, and actually create widget instances when called. Avoid
using a builder that returns a previously-constructed widget; if the list
view's children are created in advance.
The addAutomaticKeepAlives
argument corresponds to the
SliverChildBuilderDelegate.addAutomaticKeepAlives property. The
addRepaintBoundaries
argument corresponds to the
SliverChildBuilderDelegate.addRepaintBoundaries property. The
addSemanticIndexes
argument corresponds to the
SliverChildBuilderDelegate.addSemanticIndexes property. None may be
null.
Implementation
const GetSliverList.builder({
required GetItemBuilder this.itemBuilder,
this.items,
this.dividerBuilder,
this.edgeDividerBuilder,
this.headerBuilder,
this.footerBuilder,
this.sectionBuilder,
this.section,
int? itemCount,
this.divider,
this.edgeDivider = DividerStyle.full,
this.padding,
this.addAutomaticKeepAlives = true,
this.addRepaintBoundaries = true,
this.addSemanticIndexes = true,
this.scrollDirection = Axis.vertical,
Key? key,
}) : assert(itemBuilder != null),
itemCount = itemCount ?? items?.length ?? 0,
children = null,
itemExtent = null,
prototypeItem = null,
super(key: key);