BaseList constructor
BaseList({
- Key? key,
- required IndexedWidgetBuilder itemBuilder,
- int? itemCount,
- EasyRefreshController? refreshController,
- Widget? placeholder,
- Widget? header,
- VoidCallback? onRefresh,
- VoidCallback? onLoading,
- bool reverse = false,
- bool shrinkWrap = false,
- bool noScrollBehavior = false,
- bool? primary,
- Axis scrollDirection = Axis.vertical,
- Clip clipBehavior = Clip.hardEdge,
- DragStartBehavior dragStartBehavior = DragStartBehavior.start,
- String? restorationId,
- ScrollPhysics? physics,
- EdgeInsetsGeometry? padding,
- ScrollController? controller,
- ChildIndexGetter? findChildIndexCallback,
- SemanticIndexCallback semanticIndexCallback = kDefaultSemanticIndexCallback,
- bool addAutomaticKeepALives = true,
- bool addRepaintBoundaries = true,
- bool addSemanticIndexes = true,
- GridStyle gridStyle = GridStyle.none,
- IndexedWidgetBuilder? separatorBuilder,
- double? itemExtent,
- Widget? prototypeItem,
- int crossAxisCount = 1,
- double? maxCrossAxisExtent,
- double mainAxisSpacing = 0,
- double crossAxisSpacing = 0,
- double childAspectRatio = 1,
- double? mainAxisExtent,
- double? cacheExtent,
- RefreshConfig? refreshConfig,
Implementation
BaseList({
super.key,
required super.itemBuilder,
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.none,
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: Global().config.pullDownHeader,
footer: Global().config.pullUpFooter,
onLoading: onLoading == null
? null
: () async => onLoading.call(),
onRefresh: onRefresh == null
? null
: () async => onRefresh.call())
: null),
placeholder: placeholder ?? Global().config.placeholder);