SwitchThemeData class

Defines default property values for descendant Switch widgets.

Descendant widgets obtain the current SwitchThemeData object using SwitchTheme.of(context). Instances of SwitchThemeData can be customized with SwitchThemeData.copyWith.

Typically a SwitchThemeData is specified as part of the overall Theme with ThemeData.switchTheme.

All SwitchThemeData properties are null by default. When null, the Switch will use the values from ThemeData if they exist, otherwise it will provide its own defaults based on the overall Theme's colorScheme. See the individual Switch properties for details.

See also:

  • ThemeData, which describes the overall theme information for the application.
Mixed-in types
Annotations

Constructors

SwitchThemeData({MaterialStateProperty<Color?>? thumbColor, MaterialStateProperty<Color?>? trackColor, MaterialStateProperty<Color?>? trackOutlineColor, MaterialStateProperty<double?>? trackOutlineWidth, MaterialTapTargetSize? materialTapTargetSize, MaterialStateProperty<MouseCursor?>? mouseCursor, MaterialStateProperty<Color?>? overlayColor, double? splashRadius, MaterialStateProperty<Icon?>? thumbIcon, EdgeInsetsGeometry? padding})
Creates a theme that can be used for ThemeData.switchTheme.
const

Properties

hashCode int
The hash code for this object.
no setteroverride
materialTapTargetSize MaterialTapTargetSize?
Configures the minimum size of the tap target.
final
mouseCursor MaterialStateProperty<MouseCursor?>?
The cursor for a mouse pointer when it enters or is hovering over the widget.
final
overlayColor MaterialStateProperty<Color?>?
The color for the switch's Material.
final
padding EdgeInsetsGeometry?
If specified, overrides the default value of Switch.padding.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
splashRadius double?
The splash radius of the circular Material ink response.
final
thumbColor MaterialStateProperty<Color?>?
The color of this Switch's thumb.
final
thumbIcon MaterialStateProperty<Icon?>?
The icon to use on the thumb of this switch
final
trackColor MaterialStateProperty<Color?>?
The color of this Switch's track.
final
trackOutlineColor MaterialStateProperty<Color?>?
The outline color of this Switch's track.
final
trackOutlineWidth MaterialStateProperty<double?>?
The outline width of this Switch's track.
final

Methods

copyWith({MaterialStateProperty<Color?>? thumbColor, MaterialStateProperty<Color?>? trackColor, MaterialStateProperty<Color?>? trackOutlineColor, MaterialStateProperty<double?>? trackOutlineWidth, MaterialTapTargetSize? materialTapTargetSize, MaterialStateProperty<MouseCursor?>? mouseCursor, MaterialStateProperty<Color?>? overlayColor, double? splashRadius, MaterialStateProperty<Icon?>? thumbIcon, EdgeInsetsGeometry? padding}) SwitchThemeData
Creates a copy of this object but with the given fields replaced with the new values.
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringShort() String
A brief description of this object, usually just the runtimeType and the hashCode.
inherited

Operators

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

Static Methods

lerp(SwitchThemeData? a, SwitchThemeData? b, double t) SwitchThemeData
Linearly interpolate between two SwitchThemeDatas.