ToggleSwitch class
A toggle switch component
Use style presets for cleaner code:
ToggleSwitch(
value: true,
style: ToggleStyle.success,
)
- Inheritance
-
- Object
- Component
- StatefulComponent
- ToggleSwitch
Constructors
- ToggleSwitch({required bool value, void onChanged(bool)?, bool disabled = false, ToggleSwitchSize size = ToggleSwitchSize.medium, ToggleStyle? style, String? label, bool labelLeft = false, Key? key})
-
const
- ToggleSwitch.primary({required bool value, void onChanged(bool)?, bool disabled = false, ToggleSwitchSize size = ToggleSwitchSize.medium, String? label, bool labelLeft = false, Key? key})
-
Primary toggle
const
- ToggleSwitch.success({required bool value, void onChanged(bool)?, bool disabled = false, ToggleSwitchSize size = ToggleSwitchSize.medium, String? label, bool labelLeft = false, Key? key})
-
Success toggle
const
Properties
- disabled → bool
-
Whether the switch is disabled
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one component replaces another component in the tree.
finalinherited
- label → String?
-
Optional label text
final
- labelLeft → bool
-
Whether to show the label on the left side
final
- onChanged → void Function(bool)?
-
Callback when the switch is toggled
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- size → ToggleSwitchSize
-
Size of the switch
final
- style → ToggleStyle?
-
Style preset
final
- value → bool
-
Whether the switch is on
final
Methods
-
createElement(
) → Element -
Creates a StatefulElement to manage this component's location in the tree.
inherited
-
createState(
) → State< ToggleSwitch> -
Creates the mutable state for this component at a given location in the tree.
override
-
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