SwitchState.adaptive constructor
const
SwitchState.adaptive({
- Key? key,
- required bool value,
- ValueChanged<
bool> ? onChanged, - Color? activeColor,
- Color? activeTrackColor,
- Color? inactiveThumbColor,
- Color? inactiveTrackColor,
- ImageProvider<
Object> ? activeThumbImage, - ImageErrorListener? onActiveThumbImageError,
- ImageProvider<
Object> ? inactiveThumbImage, - ImageErrorListener? onInactiveThumbImageError,
- MaterialTapTargetSize? materialTapTargetSize,
- MaterialStateProperty<
Color?> ? thumbColor, - MaterialStateProperty<
Color?> ? trackColor, - DragStartBehavior dragStartBehavior = DragStartBehavior.start,
- MouseCursor? mouseCursor,
- Color? focusColor,
- Color? hoverColor,
- MaterialStateProperty<
Color?> ? overlayColor, - double? splashRadius,
- FocusNode? focusNode,
- bool autofocus = false,
- ValueCallback<
BuildContext> ? initState, - ValueCallback<
BuildContext> ? dispose, - ValueCallback<
BuildContext> ? didChangeDependencies, - ValueCallback<
BuildContext> ? didUpdateWidget, - SwitchStateChanged? onWaitChanged,
Creates an adaptive Switch based on whether the target platform is iOS or macOS, following Material design's Cross-platform guidelines.
On iOS and macOS, this constructor creates a CupertinoSwitch, which has matching functionality and presentation as Material switches, and are the graphics expected on iOS. On other platforms, this creates a Material design Switch.
If a CupertinoSwitch is created, the following parameters are ignored:
activeTrackColor
, inactiveThumbColor
, inactiveTrackColor
,
activeThumbImage
, onActiveThumbImageError
, inactiveThumbImage
,
onInactiveThumbImageError
, materialTapTargetSize
.
The target platform is based on the current Theme: ThemeData.platform.
Implementation
const SwitchState.adaptive({
super.key,
required this.value,
this.onChanged,
this.activeColor,
this.activeTrackColor,
this.inactiveThumbColor,
this.inactiveTrackColor,
this.activeThumbImage,
this.onActiveThumbImageError,
this.inactiveThumbImage,
this.onInactiveThumbImageError,
this.materialTapTargetSize,
this.thumbColor,
this.trackColor,
this.dragStartBehavior = DragStartBehavior.start,
this.mouseCursor,
this.focusColor,
this.hoverColor,
this.overlayColor,
this.splashRadius,
this.focusNode,
this.autofocus = false,
this.initState,
this.dispose,
this.didChangeDependencies,
this.didUpdateWidget,
this.onWaitChanged,
}) : _switchType = _SwitchType.adaptive;