IndexedListView.builder constructor
IndexedListView.builder({
- Key? key,
- required IndexedScrollController controller,
- required IndexedWidgetBuilderOrNull itemBuilder,
- IndexedWidgetBuilderOrNull emptyItemBuilder = defaultEmptyItemBuilder,
- Axis scrollDirection = Axis.vertical,
- bool reverse = false,
- ScrollPhysics? physics,
- EdgeInsets? padding,
- double? itemExtent,
- int? maxItemCount,
- int? minItemCount,
- bool addAutomaticKeepAlives = true,
- bool addRepaintBoundaries = true,
- double? cacheExtent,
See ListView.builder
Implementation
IndexedListView.builder({
Key? key,
required this.controller,
required IndexedWidgetBuilderOrNull itemBuilder,
this.emptyItemBuilder = defaultEmptyItemBuilder,
this.scrollDirection = Axis.vertical,
this.reverse = false,
this.physics,
this.padding,
this.itemExtent,
int? maxItemCount,
int? minItemCount,
bool addAutomaticKeepAlives = true,
bool addRepaintBoundaries = true,
this.cacheExtent,
}) : separated = false,
positiveChildrenDelegate = SliverChildBuilderDelegate(
(BuildContext context, int index) {
var _index = index + controller._originIndex;
if ((minItemCount != null && _index < minItemCount) ||
(maxItemCount != null && _index > maxItemCount))
return emptyItemBuilder(context, _index);
else
return itemBuilder(context, _index) ?? emptyItemBuilder(context, _index);
},
addAutomaticKeepAlives: addAutomaticKeepAlives,
addRepaintBoundaries: addRepaintBoundaries,
),
negativeChildrenDelegate = SliverChildBuilderDelegate(
(BuildContext context, int index) {
var _index = -1 - index + controller._originIndex;
if ((minItemCount != null && _index < minItemCount) ||
(maxItemCount != null && _index > maxItemCount))
return emptyItemBuilder(context, _index);
else
return itemBuilder(context, _index) ?? emptyItemBuilder(context, _index);
},
addAutomaticKeepAlives: addAutomaticKeepAlives,
addRepaintBoundaries: addRepaintBoundaries,
),
super(key: key);