CustomRefreshIndicator constructor

CustomRefreshIndicator({
  1. Key? key,
  2. required Widget child,
  3. required AsyncCallback onRefresh,
  4. required IndicatorBuilder builder,
  5. IndicatorController? controller,
  6. IndicatorTrigger trigger = IndicatorTrigger.leadingEdge,
  7. IndicatorTriggerMode triggerMode = IndicatorTriggerMode.onEdge,
  8. ScrollNotificationPredicate notificationPredicate = defaultScrollNotificationPredicate,
  9. bool autoRebuild = true,
  10. double? offsetToArmed,
  11. OnStateChanged? onStateChanged,
  12. double? containerExtentPercentageToArmed,
  13. @Deprecated('In favor of durations parameter') Duration? indicatorCancelDuration = const Duration(milliseconds: 300),
  14. @Deprecated('In favor of durations parameter') Duration? indicatorSettleDuration = const Duration(milliseconds: 150),
  15. @Deprecated('In favor of durations parameter') Duration? indicatorFinalizeDuration = const Duration(milliseconds: 100),
  16. @Deprecated('In favor of durations parameter') Duration? completeStateDuration,
  17. bool leadingScrollIndicatorVisible = false,
  18. bool trailingScrollIndicatorVisible = true,
  19. RefreshIndicatorDurations durations = const RefreshIndicatorDurations(),
})

Implementation

CustomRefreshIndicator({
  super.key,
  required this.child,
  required this.onRefresh,
  required this.builder,
  this.controller,
  this.trigger = IndicatorTrigger.leadingEdge,
  this.triggerMode = IndicatorTriggerMode.onEdge,
  this.notificationPredicate = defaultScrollNotificationPredicate,
  this.autoRebuild = true,
  this.offsetToArmed,
  this.onStateChanged,
  double? containerExtentPercentageToArmed,
  @Deprecated('In favor of durations parameter')
  Duration? indicatorCancelDuration = const Duration(milliseconds: 300),
  @Deprecated('In favor of durations parameter')
  Duration? indicatorSettleDuration = const Duration(milliseconds: 150),
  @Deprecated('In favor of durations parameter')
  Duration? indicatorFinalizeDuration = const Duration(milliseconds: 100),
  @Deprecated('In favor of durations parameter') Duration? completeStateDuration,
  this.leadingScrollIndicatorVisible = false,
  this.trailingScrollIndicatorVisible = true,
  RefreshIndicatorDurations durations = const RefreshIndicatorDurations(),
})  : assert(
        containerExtentPercentageToArmed == null || offsetToArmed == null,
        'Providing `extentPercentageToArmed` argument take no effect when `offsetToArmed` is provided. '
        'Remove redundant argument.',
      ),
      durations = RefreshIndicatorDurations(
        cancelDuration: indicatorCancelDuration ?? durations.cancelDuration,
        completeDuration: completeStateDuration ?? durations.completeDuration,
        finalizeDuration: indicatorFinalizeDuration ?? durations.finalizeDuration,
        settleDuration: indicatorSettleDuration ?? durations.settleDuration,
      ),
      // set the default extent percentage value if not provided
      containerExtentPercentageToArmed = containerExtentPercentageToArmed ?? defaultContainerExtentPercentageToArmed;