MoonSwitch class

Inheritance

Constructors

MoonSwitch({Key? key, bool autofocus = false, bool hasHapticFeedback = true, required bool value, Color? activeTrackColor, Color? inactiveTrackColor, Color? thumbColor, double? height, double? width, double? thumbSizeValue, Duration? duration, Curve? curve, EdgeInsetsGeometry? padding, FocusNode? focusNode, MoonSwitchSize? switchSize, String? semanticLabel, ValueChanged<bool>? onChanged, Widget? activeTrackWidget, Widget? inactiveTrackWidget, Widget? activeThumbWidget, Widget? inactiveThumbWidget})
Creates a Moon Design switch.
const

Properties

activeThumbWidget Widget?
The widget to display inside the thumb when the switch is active (on).
final
activeTrackColor Color?
The background color of the active (on) switch track.
final
activeTrackWidget Widget?
The widget to display on the left side of the switch track when the switch is active (on).
final
autofocus bool
True if this widget will be selected as the initial focus when no other node in its scope is currently focused.
final
curve Curve?
The curve of the switch toggle animation.
final
duration Duration?
The duration of the switch toggle animation.
final
focusNode FocusNode?
An optional focus node to use as the focus node for this widget.
final
hasHapticFeedback bool
Whether to use haptic feedback (vibration) when the switch is toggled.
final
hashCode int
The hash code for this object.
no setterinherited
height double?
The height of the switch.
final
inactiveThumbWidget Widget?
The widget to display inside the thumb when the switch is inactive (off).
final
inactiveTrackColor Color?
The background color of the inactive (off) switch track.
final
inactiveTrackWidget Widget?
The widget to display on the right side of the switch track when the switch is inactive (off).
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
onChanged ValueChanged<bool>?
The callback that is called when the switch toggles between the active (on) and inactive (off) states.
final
padding EdgeInsetsGeometry?
The padding of the switch.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
semanticLabel String?
The semantic label for the switch.
final
switchSize MoonSwitchSize?
The size of the switch.
final
thumbColor Color?
The color of the switch thumb.
final
thumbSizeValue double?
The size of the switch thumb.
final
value bool
Whether the switch is in active (on) state.
final
width double?
The width of the switch.
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() → _MoonSwitchState
Creates the mutable state for this widget at a given location in the tree.
override
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
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
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A short, textual description of this widget.
inherited

Operators

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