PlatformSwitchData class final

Platform-shared configuration for a switch widget.

Contains common properties used by both Switch and CupertinoSwitch.

Implementers

Constructors

PlatformSwitchData({bool? value, ValueChanged<bool>? onChanged, bool isEnabled = true, Color? activeThumbColor, Color? activeTrackColor, Color? inactiveThumbColor, Color? inactiveTrackColor, Color? focusColor, ImageProvider<Object>? activeThumbImage, ImageErrorListener? onActiveThumbImageError, ImageProvider<Object>? inactiveThumbImage, ImageErrorListener? onInactiveThumbImageError, WidgetStateProperty<Color?>? trackOutlineColor, WidgetStateProperty<double?>? trackOutlineWidth, WidgetStateProperty<Icon?>? thumbIcon, DragStartBehavior dragStartBehavior = kDefaultDragStartBehavior, WidgetStateProperty<MouseCursor>? mouseCursor, FocusNode? focusNode, ValueChanged<bool>? onFocusChange, bool autofocus = kDefaultAutofocus, Key? widgetKey})
isEnabled is a convenience property for setting onChanged == null automatically. activeThumbColor is used for thumbColor property of CupertinoSwitch. mouseCursor is not proxied through a WidgetStateProperty for Switch. It is defined by matching the same template/behaviour.
const

Properties

activeThumbColor Color?
Color of the thumb when the switch is active.
final
activeThumbImage ImageProvider<Object>?
Image displayed on the thumb when the switch is active.
final
activeTrackColor Color?
Color of the track when the switch is active.
final
autofocus bool
Whether the switch should autofocus.
final
dragStartBehavior DragStartBehavior
Drag start behavior for the switch.
final
focusColor Color?
Color of the switch when focused.
final
focusNode FocusNode?
Focus node for the switch.
final
hashCode int
The hash code for this object.
no setterinherited
inactiveThumbColor Color?
Color of the thumb when the switch is inactive.
final
inactiveThumbImage ImageProvider<Object>?
Image displayed on the thumb when the switch is inactive.
final
inactiveTrackColor Color?
Color of the track when the switch is inactive.
final
isEnabled bool
Whether the switch is enabled.
final
mouseCursor WidgetStateProperty<MouseCursor>?
Mouse cursor as a WidgetStateProperty.
final
onActiveThumbImageError ImageErrorListener?
Error listener for the active thumb image.
final
onChanged ValueChanged<bool>?
Callback when the switch value changes.
final
onFocusChange ValueChanged<bool>?
Callback when the focus state changes.
final
onInactiveThumbImageError ImageErrorListener?
Error listener for the inactive thumb image.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
thumbIcon WidgetStateProperty<Icon?>?
Thumb icon as a WidgetStateProperty.
final
trackOutlineColor WidgetStateProperty<Color?>?
Track outline color as a WidgetStateProperty.
final
trackOutlineWidth WidgetStateProperty<double?>?
Track outline width as a WidgetStateProperty.
final
value bool?
Current value of the switch.
final
widgetKey Key?
Key applied to the underlying platform widget.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Constants

kDefaultAutofocus → const bool
Default value for autofocus.
kDefaultDragStartBehavior → const DragStartBehavior
Default value for dragStartBehavior.