BaseList.waterfall constructor

BaseList.waterfall({
  1. Key? key,
  2. required IndexedWidgetBuilder itemBuilder,
  3. required int? itemCount,
  4. EasyRefreshController? refreshController,
  5. Widget? placeholder,
  6. Widget? header,
  7. Widget? footer,
  8. VoidCallback? onRefresh,
  9. VoidCallback? onLoading,
  10. bool reverse = false,
  11. bool shrinkWrap = false,
  12. bool noScrollBehavior = false,
  13. bool? primary,
  14. Axis scrollDirection = Axis.vertical,
  15. Clip clipBehavior = Clip.hardEdge,
  16. DragStartBehavior dragStartBehavior = DragStartBehavior.start,
  17. String? restorationId,
  18. ScrollPhysics? physics,
  19. EdgeInsetsGeometry? padding,
  20. ScrollController? controller,
  21. ChildIndexGetter? findChildIndexCallback,
  22. SemanticIndexCallback semanticIndexCallback = kDefaultSemanticIndexCallback,
  23. bool addAutomaticKeepALives = true,
  24. bool addRepaintBoundaries = true,
  25. bool addSemanticIndexes = true,
  26. GridStyle gridStyle = GridStyle.masonry,
  27. IndexedWidgetBuilder? separatorBuilder,
  28. double? itemExtent,
  29. Widget? prototypeItem,
  30. int crossAxisCount = 1,
  31. double? maxCrossAxisExtent,
  32. double mainAxisSpacing = 0,
  33. double crossAxisSpacing = 0,
  34. double childAspectRatio = 1,
  35. double? mainAxisExtent,
  36. double? cacheExtent,
  37. RefreshConfig? refreshConfig,
})

Implementation

BaseList.waterfall({
  super.key,
  required super.itemBuilder,
  required super.itemCount,
  EasyRefreshController? refreshController,
  Widget? placeholder,
  Widget? header,
  Widget? footer,
  VoidCallback? onRefresh,
  VoidCallback? onLoading,
  super.reverse = false,
  super.shrinkWrap = false,
  super.noScrollBehavior = false,
  super.primary,
  super.scrollDirection = Axis.vertical,
  super.clipBehavior = Clip.hardEdge,
  super.dragStartBehavior = DragStartBehavior.start,
  super.restorationId,
  super.physics,
  super.padding,
  super.controller,
  super.findChildIndexCallback,
  super.semanticIndexCallback = kDefaultSemanticIndexCallback,
  super.addAutomaticKeepALives = true,
  super.addRepaintBoundaries = true,
  super.addSemanticIndexes = true,
  super.gridStyle = GridStyle.masonry,
  super.separatorBuilder,

  /// use [SliverFixedExtentList]、[itemExtent] 优先 [prototypeItem]
  super.itemExtent,

  /// use [SliverPrototypeExtentList]、[itemExtent] 优先 [prototypeItem]
  super.prototypeItem,

  /// 横轴子元素的数量 自适应最大像素
  /// use [SliverGridDelegateWithFixedCrossAxisCount] or [SliverSimpleGridDelegateWithFixedCrossAxisCount]
  super.crossAxisCount = 1,

  /// 横轴元素最大像素 自适应列数
  /// use [SliverGridDelegateWithMaxCrossAxisExtent] or [SliverSimpleGridDelegateWithMaxCrossAxisExtent]
  super.maxCrossAxisExtent,

  /// 主轴方向子元素的间距
  super.mainAxisSpacing = 0,

  /// 横轴方向子元素的间距
  super.crossAxisSpacing = 0,

  /// 子元素在横轴长度和主轴长度的比例
  super.childAspectRatio = 1,

  /// 子元素在主轴上的长度。[mainAxisExtent] 优先 [childAspectRatio]
  super.mainAxisExtent,
  super.cacheExtent,
  RefreshConfig? refreshConfig,
}) : super.builder(
          header: header?.toSliverBox,
          footer: footer?.toSliverBox,
          refreshConfig: refreshConfig ??
              ((onRefresh != null || onLoading != null)
                  ? RefreshConfig(
                      controller: refreshController,
                      header: Universally().config.pullDownHeader,
                      footer: Universally().config.pullUpFooter,
                      onLoading: onLoading == null
                          ? null
                          : () async => onLoading.call(),
                      onRefresh: onRefresh == null
                          ? null
                          : () async => onRefresh.call())
                  : null),
          placeholder: placeholder ?? Universally().config.placeholder);