SmartRefresher.builder constructor
const
SmartRefresher.builder({
- Key? key,
- required RefreshController controller,
- required RefresherBuilder? builder,
- bool enablePullDown = true,
- bool enablePullUp = false,
- VoidCallback? onRefresh,
- VoidCallback? onLoading,
- bool? enableSmartPreload,
创建一个带有下拉刷新和上拉加载功能的组件,使用自定义构建器
适用场景:
- 处理特殊的第三方组件,这些组件需要传递 slivers 但不继承自 ScrollView
- 避免 scrollable 嵌套 scrollable 的问题
- 例如:在 NestedScrollView 上方实现刷新(目前 NestedScrollView 不支持边缘过度滚动)
必填参数:
controller:控制刷新和加载状态的控制器,不能为空builder:自定义内容构建器,不能为空
其他参数:
enablePullDown:是否启用下拉刷新,默认为 trueenablePullUp:是否启用上拉加载,默认为 falseonRefresh:下拉刷新回调函数onLoading:上拉加载回调函数
Implementation
const SmartRefresher.builder({
super.key,
required this.controller,
required this.builder,
this.enablePullDown = true,
this.enablePullUp = false,
this.onRefresh,
this.onLoading,
this.enableSmartPreload,
}) : header = null,
footer = null,
child = null,
scrollController = null,
scrollDirection = null,
physics = null,
reverse = null,
semanticChildCount = null,
dragStartBehavior = null,
cacheExtent = null,
primary = null;