CupertinoListView.builder constructor
CupertinoListView.builder(
- {required int sectionCount,
- required SectionBuilder sectionBuilder,
- required SectionChildBuilder childBuilder,
- required SectionItemCount itemInSectionCount,
- ChildSeparatorBuilder? separatorBuilder,
- ScrollController? controller,
- double? cacheExtent,
- Clip clipBehavior = Clip.hardEdge,
- DragStartBehavior dragStartBehavior = DragStartBehavior.start,
- ScrollPhysics? physics,
- String? restorationId,
- EdgeInsets? padding,
- ScrollViewKeyboardDismissBehavior keyboardDismissBehavior = ScrollViewKeyboardDismissBehavior.manual}
Creates a scrollable, linear array of widgets that are created on demand, defined by sections. A section is a widget describing a finite group of children.
To define these section, the CupertinoListView first retrieve the number
of sections using sectionCount
input parameter.
Then the widget will call itemInSectionCount
to define
the number of children each section has.
Added to that, the CupertinoListView display the current section as a floating widget, that will be pushed away by the next section title, as iOS UITableView does.
This constructor is appropriate for list views with a large (or infinite) number of children because the builder is called only for those children that are actually visible.
Implementation
factory CupertinoListView.builder({
required int sectionCount,
required SectionBuilder sectionBuilder,
required SectionChildBuilder childBuilder,
required SectionItemCount itemInSectionCount,
ChildSeparatorBuilder? separatorBuilder,
ScrollController? controller,
double? cacheExtent,
Clip clipBehavior = Clip.hardEdge,
DragStartBehavior dragStartBehavior = DragStartBehavior.start,
ScrollPhysics? physics,
String? restorationId,
EdgeInsets? padding,
ScrollViewKeyboardDismissBehavior keyboardDismissBehavior =
ScrollViewKeyboardDismissBehavior.manual,
}) {
assert(sectionCount > 0);
final delegate = CupertinoListBuilderDelegate(
sectionCount: sectionCount,
childBuilder: childBuilder,
sectionBuilder: sectionBuilder,
itemInSectionCount: itemInSectionCount,
separatorBuilder: separatorBuilder,
);
return CupertinoListView._(
delegate: delegate,
controller: controller,
padding: padding,
cacheExtent: cacheExtent,
clipBehavior: clipBehavior,
dragStartBehavior: dragStartBehavior,
keyboardDismissBehavior: keyboardDismissBehavior,
physics: physics,
restorationId: restorationId,
);
}