SwitchThemeData class Null safety

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, MaterialTapTargetSize? materialTapTargetSize, MaterialStateProperty<MouseCursor?>? mouseCursor, MaterialStateProperty<Color?>? overlayColor, double? splashRadius})
Creates a theme that can be used for ThemeData.switchTheme.
const

Properties

hashCode int
The hash code for this object. [...]
read-only, override
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
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
splashRadius double?
The splash radius of the circular Material ink response. [...]
final
thumbColor MaterialStateProperty<Color?>?
The color of this Switch's thumb. [...]
final
trackColor MaterialStateProperty<Color?>?
The color of this Switch's track. [...]
final

Methods

copyWith({MaterialStateProperty<Color?>? thumbColor, MaterialStateProperty<Color?>? trackColor, MaterialTapTargetSize? materialTapTargetSize, MaterialStateProperty<MouseCursor?>? mouseCursor, MaterialStateProperty<Color?>? overlayColor, double? splashRadius}) 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 non-existent 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. [...]