SmartRefresher constructor
const
SmartRefresher({
- Key? key,
- required RefreshController controller,
- Widget? child,
- Widget? header,
- bool enablePullDown = true,
- bool enablePullUp = false,
- VoidCallback? onRefresh,
- VoidCallback? onLoading,
- DragStartBehavior? dragStartBehavior,
- bool? primary,
- double? cacheExtent,
- int? semanticChildCount,
- bool? reverse,
- ScrollPhysics? physics,
- Axis? scrollDirection,
- ScrollController? scrollController,
- bool? enableSmartPreload,
创建一个带有下拉刷新和上拉加载功能的组件
必填参数:
controller:控制刷新和加载状态的控制器,不能为空
核心参数:
child:刷新内容组件enablePullDown:是否启用下拉刷新,默认为 trueenablePullUp:是否启用上拉加载,默认为 falseonRefresh:下拉刷新回调函数onLoading:上拉加载回调函数
指示器参数:
header:自定义头部刷新指示器footer:自定义底部加载指示器
滚动相关参数(复制自 ScrollView):
scrollDirection:滚动方向reverse:是否反向滚动scrollController:滚动控制器primary:是否使用 primary scroll controllerphysics:滚动物理效果cacheExtent:缓存区域大小semanticChildCount:语义化子组件数量dragStartBehavior:拖动开始行为
使用注意:
Implementation
const SmartRefresher(
{super.key,
required this.controller,
this.child,
this.header,
this.footer,
this.enablePullDown = true,
this.enablePullUp = false,
this.onRefresh,
this.onLoading,
this.dragStartBehavior,
this.primary,
this.cacheExtent,
this.semanticChildCount,
this.reverse,
this.physics,
this.scrollDirection,
this.scrollController,
this.enableSmartPreload})
: builder = null;