MaterialSwitchData class final

Material-specific configuration for a switch widget.

Extends PlatformSwitchData with Material-only properties.

Inheritance

Constructors

MaterialSwitchData({bool? value, ValueChanged<bool>? onChanged, Key? widgetKey, 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, WidgetStateProperty<Color?>? thumbColor, WidgetStateProperty<Color?>? trackColor, WidgetStateProperty<Color?>? overlayColor, MaterialTapTargetSize? materialTapTargetSize, Color? hoverColor, double? splashRadius, EdgeInsetsGeometry? padding})
isEnabled is a convenience property for setting onChanged == null automatically. 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.
finalinherited
activeThumbImage ImageProvider<Object>?
Image displayed on the thumb when the switch is active.
finalinherited
activeTrackColor Color?
Color of the track when the switch is active.
finalinherited
autofocus bool
Whether the switch should autofocus.
finalinherited
dragStartBehavior DragStartBehavior
Drag start behavior for the switch.
finalinherited
focusColor Color?
Color of the switch when focused.
finalinherited
focusNode FocusNode?
Focus node for the switch.
finalinherited
hashCode int
The hash code for this object.
no setterinherited
hoverColor Color?
Color when hovering over the switch.
final
inactiveThumbColor Color?
Color of the thumb when the switch is inactive.
finalinherited
inactiveThumbImage ImageProvider<Object>?
Image displayed on the thumb when the switch is inactive.
finalinherited
inactiveTrackColor Color?
Color of the track when the switch is inactive.
finalinherited
isEnabled bool
Whether the switch is enabled.
finalinherited
materialTapTargetSize MaterialTapTargetSize?
Material tap target size.
final
mouseCursor WidgetStateProperty<MouseCursor>?
Mouse cursor as a WidgetStateProperty.
finalinherited
onActiveThumbImageError ImageErrorListener?
Error listener for the active thumb image.
finalinherited
onChanged ValueChanged<bool>?
Callback when the switch value changes.
finalinherited
onFocusChange ValueChanged<bool>?
Callback when the focus state changes.
finalinherited
onInactiveThumbImageError ImageErrorListener?
Error listener for the inactive thumb image.
finalinherited
overlayColor WidgetStateProperty<Color?>?
Overlay color as a WidgetStateProperty.
final
padding EdgeInsetsGeometry?
Padding around the switch.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
splashRadius double?
Splash radius of the switch.
final
thumbColor WidgetStateProperty<Color?>?
Thumb color as a WidgetStateProperty.
final
thumbIcon WidgetStateProperty<Icon?>?
Thumb icon as a WidgetStateProperty.
finalinherited
trackColor WidgetStateProperty<Color?>?
Track color as a WidgetStateProperty.
final
trackOutlineColor WidgetStateProperty<Color?>?
Track outline color as a WidgetStateProperty.
finalinherited
trackOutlineWidth WidgetStateProperty<double?>?
Track outline width as a WidgetStateProperty.
finalinherited
value bool?
Current value of the switch.
finalinherited
widgetKey Key?
Key applied to the underlying platform widget.
finalinherited

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