RefreshIndicator.adaptive constructor
- Key? key,
- required Widget child,
- double displacement = 40.0,
- double edgeOffset = 0.0,
- required RefreshCallback onRefresh,
- Color? color,
- Color? backgroundColor,
- ScrollNotificationPredicate notificationPredicate = defaultScrollNotificationPredicate,
- String? semanticsLabel,
- String? semanticsValue,
- double strokeWidth = RefreshProgressIndicator.defaultStrokeWidth,
- RefreshIndicatorTriggerMode triggerMode = RefreshIndicatorTriggerMode.onEdge,
- 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);