RefreshIndicator.adaptive constructor

const RefreshIndicator.adaptive({
  1. Key? key,
  2. required Widget child,
  3. double displacement = 40.0,
  4. double edgeOffset = 0.0,
  5. required RefreshCallback onRefresh,
  6. Color? color,
  7. Color? backgroundColor,
  8. ScrollNotificationPredicate notificationPredicate = defaultScrollNotificationPredicate,
  9. String? semanticsLabel,
  10. String? semanticsValue,
  11. double strokeWidth = RefreshProgressIndicator.defaultStrokeWidth,
  12. RefreshIndicatorTriggerMode triggerMode = RefreshIndicatorTriggerMode.onEdge,
  13. double elevation = 2.0,
})

Creates an adaptive RefreshIndicator based on whether the target platform is iOS or macOS, following Material design's Cross-platform guidelines.

When the descendant overscrolls, a different spinning progress indicator is shown depending on platform. On iOS and macOS, CupertinoActivityIndicator is shown, but on all other platforms, CircularProgressIndicator appears.

If a CupertinoActivityIndicator is shown, the following parameters are ignored: backgroundColor, semanticsLabel, semanticsValue, strokeWidth.

The target platform is based on the current Theme: ThemeData.platform.

Notably the scrollable widget itself will have slightly different behavior from CupertinoSliverRefreshControl, due to a difference in structure.

Implementation

const RefreshIndicator.adaptive({
  super.key,
  required this.child,
  this.displacement = 40.0,
  this.edgeOffset = 0.0,
  required this.onRefresh,
  this.color,
  this.backgroundColor,
  this.notificationPredicate = defaultScrollNotificationPredicate,
  this.semanticsLabel,
  this.semanticsValue,
  this.strokeWidth = RefreshProgressIndicator.defaultStrokeWidth,
  this.triggerMode = RefreshIndicatorTriggerMode.onEdge,
  this.elevation = 2.0,
})  : _indicatorType = _IndicatorType.adaptive,
      onStatusChange = null,
      assert(elevation >= 0.0);