RefreshConfiguration constructor

const RefreshConfiguration({
  1. Key? key,
  2. required Widget child,
  3. IndicatorBuilder? headerBuilder,
  4. IndicatorBuilder? footerBuilder,
  5. double dragSpeedRatio = 1.0,
  6. ShouldFollowContent? shouldFooterFollowWhenNotFull,
  7. bool enableLoadingWhenNoData = false,
  8. bool enableSmartPreload = true,
  9. bool enableBallisticRefresh = false,
  10. SpringDescription springDescription = const SpringDescription(mass: 1.0, stiffness: 364.72, damping: 35.2),
  11. bool enableScrollWhenRefreshCompleted = false,
  12. bool enableLoadingWhenFailed = true,
  13. double twiceTriggerDistance = 150.0,
  14. bool skipCanRefresh = false,
  15. double? maxOverScrollExtent,
  16. bool enableBallisticLoad = true,
  17. double? maxUnderScrollExtent,
  18. double headerTriggerDistance = 80.0,
  19. double footerTriggerDistance = 15.0,
  20. bool hideFooterWhenNotFull = false,
  21. bool enableRefreshVibrate = false,
  22. bool enableLoadMoreVibrate = false,
  23. double? topHitBoundary,
  24. double? bottomHitBoundary,
})

创建刷新配置

必填参数

  • child:子组件树

常用参数

  • headerBuilder:全局默认 header 构建器
  • footerBuilder:全局默认 footer 构建器
  • headerTriggerDistance:触发刷新的距离,默认为 80.0
  • enableSmartPreload:是否启用智能预加载,默认为 true
  • footerTriggerDistance:触发加载的距离,默认为 15.0
  • springDescription:弹簧动画配置
  • enableScrollWhenRefreshCompleted:刷新完成回弹时是否允许滚动

Implementation

const RefreshConfiguration(
    {super.key,
    required this.child,
    this.headerBuilder,
    this.footerBuilder,
    this.dragSpeedRatio = 1.0,
    this.shouldFooterFollowWhenNotFull,
    this.enableLoadingWhenNoData = false,
    this.enableSmartPreload = true,
    this.enableBallisticRefresh = false,
    this.springDescription = const SpringDescription(
      mass: 1.0,
      stiffness: 364.72,
      damping: 35.2,
    ),
    this.enableScrollWhenRefreshCompleted = false,
    this.enableLoadingWhenFailed = true,
    this.twiceTriggerDistance = 150.0,
    this.skipCanRefresh = false,
    this.maxOverScrollExtent,
    this.enableBallisticLoad = true,
    this.maxUnderScrollExtent,
    this.headerTriggerDistance = 80.0,
    this.footerTriggerDistance = 15.0,
    this.hideFooterWhenNotFull = false,
    this.enableRefreshVibrate = false,
    this.enableLoadMoreVibrate = false,
    this.topHitBoundary,
    this.bottomHitBoundary})
    : assert(headerTriggerDistance > 0),
      assert(twiceTriggerDistance > 0),
      assert(dragSpeedRatio > 0),
      super(child: child);