SuperListView.separated constructor

SuperListView.separated({
  1. Key? key,
  2. Axis scrollDirection = Axis.vertical,
  3. bool reverse = false,
  4. ScrollController? controller,
  5. bool? primary,
  6. ScrollPhysics? physics,
  7. bool shrinkWrap = false,
  8. EdgeInsetsGeometry? padding,
  9. required NullableIndexedWidgetBuilder itemBuilder,
  10. ChildIndexGetter? findChildIndexCallback,
  11. required IndexedWidgetBuilder separatorBuilder,
  12. required int itemCount,
  13. bool addAutomaticKeepAlives = true,
  14. bool addRepaintBoundaries = true,
  15. bool addSemanticIndexes = true,
  16. double? cacheExtent,
  17. DragStartBehavior dragStartBehavior = DragStartBehavior.start,
  18. ScrollViewKeyboardDismissBehavior? keyboardDismissBehavior,
  19. String? restorationId,
  20. Clip clipBehavior = Clip.hardEdge,
  21. ListController? listController,
  22. ExtentEstimationProvider? extentEstimation,
  23. ExtentPrecalculationPolicy? extentPrecalculationPolicy,
  24. bool delayPopulatingCacheArea = false,
})

Creates a SuperListView with "items" separated by list item "separators".

See ListView.separated for details.

Implementation

SuperListView.separated({
  super.key,
  super.scrollDirection,
  super.reverse,
  super.controller,
  super.primary,
  super.physics,
  super.shrinkWrap,
  super.padding,
  required NullableIndexedWidgetBuilder itemBuilder,
  ChildIndexGetter? findChildIndexCallback,
  required IndexedWidgetBuilder separatorBuilder,
  required int itemCount,
  bool addAutomaticKeepAlives = true,
  bool addRepaintBoundaries = true,
  bool addSemanticIndexes = true,
  super.cacheExtent,
  super.dragStartBehavior,
  super.keyboardDismissBehavior,
  super.restorationId,
  super.clipBehavior,
  this.listController,
  this.extentEstimation,
  this.extentPrecalculationPolicy,
  this.delayPopulatingCacheArea = false,
})  : assert(itemCount >= 0),
      childrenDelegate = SliverChildBuilderDelegate(
        (BuildContext context, int index) {
          final int itemIndex = index ~/ 2;
          if (index.isEven) {
            return itemBuilder(context, itemIndex);
          }
          return separatorBuilder(context, itemIndex);
        },
        findChildIndexCallback: findChildIndexCallback,
        childCount: _computeActualChildCount(itemCount),
        addAutomaticKeepAlives: addAutomaticKeepAlives,
        addRepaintBoundaries: addRepaintBoundaries,
        addSemanticIndexes: addSemanticIndexes,
        semanticIndexCallback: (Widget widget, int index) {
          return index.isEven ? index ~/ 2 : null;
        },
      ),
      super(
        semanticChildCount: itemCount,
      );