OneUISwitch constructor
const
OneUISwitch({
- Key? key,
- required bool value,
- required ValueChanged<
bool> ? onChanged, - bool useOneUIColor = false,
- Color? activeColor,
- Color? disabledThumbColor,
- ImageProvider<
Object> ? activeThumbImage, - ImageErrorListener? onActiveThumbImageError,
- ImageProvider<
Object> ? inactiveThumbImage, - ImageErrorListener? onInactiveThumbImageError,
- Color? thumbColor,
- MaterialStateProperty<
Color?> ? trackColor, - MaterialStateProperty<
Color?> ? thumbBorderColor, - MaterialStateProperty<
Color?> ? trackBorderColor, - MaterialTapTargetSize? materialTapTargetSize,
- DragStartBehavior dragStartBehavior = DragStartBehavior.start,
- MouseCursor? mouseCursor,
- Color? focusColor,
- Color? hoverColor,
- MaterialStateProperty<
Color?> ? overlayColor, - double? splashRadius,
- FocusNode? focusNode,
- bool autofocus = false,
Creates a OneUI design switch.
The switch itself does not maintain any state. Instead, when the state of the switch changes, the widget calls the onChanged callback. Most widgets that use a switch will listen for the onChanged callback and rebuild the switch with a new value to update the visual appearance of the switch.
The following arguments are required:
Implementation
const OneUISwitch({
Key? key,
required this.value,
required this.onChanged,
this.useOneUIColor = false,
this.activeColor,
this.disabledThumbColor,
this.activeThumbImage,
this.onActiveThumbImageError,
this.inactiveThumbImage,
this.onInactiveThumbImageError,
this.thumbColor,
this.trackColor,
this.thumbBorderColor,
this.trackBorderColor,
this.materialTapTargetSize,
this.dragStartBehavior = DragStartBehavior.start,
this.mouseCursor,
this.focusColor,
this.hoverColor,
this.overlayColor,
this.splashRadius,
this.focusNode,
this.autofocus = false,
}) : assert(activeThumbImage != null || onActiveThumbImageError == null),
assert(inactiveThumbImage != null || onInactiveThumbImageError == null),
super(key: key);