Toggle class

A boolean toggle switch (on/off).

Displays as a labeled indicator that flips between active and inactive states. Calls onChanged with the new value when activated.

Inheritance

Constructors

Toggle({Key? key, required bool value, ValueChanged<bool>? onChanged, FocusNode? focusNode, Color? activeColor, Color? inactiveColor, String? label})
Creates a Toggle with the given value and optional onChanged.
const

Properties

activeColor Color?
The color of the toggle when in the active state.
final
focusNode FocusNode?
An optional focus node for keyboard navigation.
final
hashCode int
The hash code for this object.
no setterinherited
inactiveColor Color?
The color of the indicator when in the inactive state.
final
key Key?
Controls how one widget replaces another in the tree.
finalinherited
label String?
An optional text label displayed beside the toggle.
final
onChanged ValueChanged<bool>?
Called when the user toggles the value.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
value bool
Whether the toggle is currently in the active (on) state.
final

Methods

createElement() StatefulElement
Creates the Element for this widget.
inherited
createState() State<Toggle>
Creates the mutable state for this widget.
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