RefreshConfiguration.copyAncestor constructor

RefreshConfiguration.copyAncestor({
  1. Key? key,
  2. required BuildContext context,
  3. required Widget child,
  4. IndicatorBuilder? headerBuilder,
  5. IndicatorBuilder? footerBuilder,
  6. double? dragSpeedRatio,
  7. ShouldFollowContent? shouldFooterFollowWhenNotFull,
  8. bool? enableBallisticRefresh,
  9. bool? enableBallisticLoad,
  10. bool? enableLoadingWhenNoData,
  11. bool? enableSmartPreload,
  12. SpringDescription? springDescription,
  13. bool? enableScrollWhenRefreshCompleted,
  14. bool? enableLoadingWhenFailed,
  15. double? twiceTriggerDistance,
  16. bool? skipCanRefresh,
  17. double? maxOverScrollExtent,
  18. double? maxUnderScrollExtent,
  19. double? topHitBoundary,
  20. double? bottomHitBoundary,
  21. double? headerTriggerDistance,
  22. double? footerTriggerDistance,
  23. bool? enableRefreshVibrate,
  24. bool? enableLoadMoreVibrate,
  25. bool? hideFooterWhenNotFull,
})

复制祖先节点的 RefreshConfiguration,并可选择性覆盖部分属性

如果参数为 null,将自动继承祖先 RefreshConfiguration 的属性,无需手动复制

适用场景

  • 应用中某个 SmartRefresher 需要与其他组件不同的配置
  • 局部覆盖全局配置

必填参数

  • context:构建上下文,用于查找祖先配置
  • child:子组件树

Implementation

RefreshConfiguration.copyAncestor({
  super.key,
  required BuildContext context,
  required this.child,
  IndicatorBuilder? headerBuilder,
  IndicatorBuilder? footerBuilder,
  double? dragSpeedRatio,
  ShouldFollowContent? shouldFooterFollowWhenNotFull,
  bool? enableBallisticRefresh,
  bool? enableBallisticLoad,
  bool? enableLoadingWhenNoData,
  bool? enableSmartPreload,
  SpringDescription? springDescription,
  bool? enableScrollWhenRefreshCompleted,
  bool? enableLoadingWhenFailed,
  double? twiceTriggerDistance,
  bool? skipCanRefresh,
  double? maxOverScrollExtent,
  double? maxUnderScrollExtent,
  double? topHitBoundary,
  double? bottomHitBoundary,
  double? headerTriggerDistance,
  double? footerTriggerDistance,
  bool? enableRefreshVibrate,
  bool? enableLoadMoreVibrate,
  bool? hideFooterWhenNotFull,
})  : assert(RefreshConfiguration.of(context) != null,
          "search RefreshConfiguration anscestor return null,please  Make sure that RefreshConfiguration is the ancestor of that element"),
      headerBuilder = headerBuilder ?? RefreshConfiguration.of(context)!.headerBuilder,
      footerBuilder = footerBuilder ?? RefreshConfiguration.of(context)!.footerBuilder,
      dragSpeedRatio = dragSpeedRatio ?? RefreshConfiguration.of(context)!.dragSpeedRatio,
      twiceTriggerDistance = twiceTriggerDistance ?? RefreshConfiguration.of(context)!.twiceTriggerDistance,
      headerTriggerDistance = headerTriggerDistance ?? RefreshConfiguration.of(context)!.headerTriggerDistance,
      footerTriggerDistance = footerTriggerDistance ?? RefreshConfiguration.of(context)!.footerTriggerDistance,
      springDescription = springDescription ?? RefreshConfiguration.of(context)!.springDescription,
      hideFooterWhenNotFull = hideFooterWhenNotFull ?? RefreshConfiguration.of(context)!.hideFooterWhenNotFull,
      maxOverScrollExtent = maxOverScrollExtent ?? RefreshConfiguration.of(context)!.maxOverScrollExtent,
      maxUnderScrollExtent = maxUnderScrollExtent ?? RefreshConfiguration.of(context)!.maxUnderScrollExtent,
      topHitBoundary = topHitBoundary ?? RefreshConfiguration.of(context)!.topHitBoundary,
      bottomHitBoundary = bottomHitBoundary ?? RefreshConfiguration.of(context)!.bottomHitBoundary,
      skipCanRefresh = skipCanRefresh ?? RefreshConfiguration.of(context)!.skipCanRefresh,
      enableScrollWhenRefreshCompleted =
          enableScrollWhenRefreshCompleted ?? RefreshConfiguration.of(context)!.enableScrollWhenRefreshCompleted,
      enableBallisticRefresh = enableBallisticRefresh ?? RefreshConfiguration.of(context)!.enableBallisticRefresh,
      enableBallisticLoad = enableBallisticLoad ?? RefreshConfiguration.of(context)!.enableBallisticLoad,
      enableLoadingWhenNoData = enableLoadingWhenNoData ?? RefreshConfiguration.of(context)!.enableLoadingWhenNoData,
      enableSmartPreload = enableSmartPreload ?? RefreshConfiguration.of(context)!.enableSmartPreload,
      enableLoadingWhenFailed = enableLoadingWhenFailed ?? RefreshConfiguration.of(context)!.enableLoadingWhenFailed,
      enableRefreshVibrate = enableRefreshVibrate ?? RefreshConfiguration.of(context)!.enableRefreshVibrate,
      enableLoadMoreVibrate = enableLoadMoreVibrate ?? RefreshConfiguration.of(context)!.enableLoadMoreVibrate,
      shouldFooterFollowWhenNotFull =
          shouldFooterFollowWhenNotFull ?? RefreshConfiguration.of(context)!.shouldFooterFollowWhenNotFull,
      super(child: child);