ToggleSwitch class

Inheritance

Constructors

ToggleSwitch({Key? key, int? totalSwitches, List<String>? labels, List<bool>? states, List<Color>? borderColor, double? borderWidth, Color dividerColor = Colors.white30, List<Color>? activeBgColor, Color? activeFgColor, Color? inactiveBgColor, Color? inactiveFgColor, OnToggle? onToggle, CancelToggle? cancelToggle, double cornerRadius = 8.0, int? initialLabelIndex = 0, double minWidth = 72.0, double minHeight = 40.0, bool changeOnTap = true, List<IconData?>? icons, List<List<Color>?>? activeBgColors, List<TextStyle?>? customTextStyles, List<Icon?>? customIcons, List<double>? customWidths, List<double>? customHeights, bool animate = false, int animationDuration = 800, Curve curve = Curves.easeIn, bool radiusStyle = false, bool textDirectionRTL = false, double fontSize = 14.0, double iconSize = 17.0, double? dividerMargin = 8.0, bool doubleTapDisable = false, bool isVertical = false, List<Border?>? activeBorders, bool centerText = false, bool multiLineText = false, List<Widget>? customWidgets})

Properties

activeBgColor List<Color>?
Active background color
final
activeBgColors List<List<Color>?>?
List of active background colors (gradient)
final
activeBorders List<Border?>?
Set a border only to the active toggle component
getter/setter pair
activeFgColor Color?
Active foreground color
final
animate bool
Set animation
final
animationDuration int
Set animation duration
final
borderColor List<Color>?
Border color (gradient)
final
borderWidth double?
Border width
final
cancelToggle CancelToggle?
CancelToggle function
final
centerText bool
Set the label to the center
final
changeOnTap bool
Change selection on tap
final
cornerRadius double
Widget's corner radius
final
curve Curve
Animation curve
final
customHeights List<double>?
List of custom heights
final
customIcons List<Icon?>?
List of custom icons
final
customTextStyles List<TextStyle?>?
List of custom text styles
final
customWidgets List<Widget>?
Set custom widget
final
customWidths List<double>?
List of custom widths
final
dividerColor Color
Divider color
final
dividerMargin double?
Divider margin
final
doubleTapDisable bool
Tap active switch to de-activate/de-select
final
fontSize double
Font size
final
hashCode int
The hash code for this object.
no setterinherited
icons List<IconData?>?
List of icons
final
iconSize double
Icon size
final
inactiveBgColor Color?
Inactive background color
final
inactiveFgColor Color?
Inactive foreground color
final
initialLabelIndex int?
Initial label index, set to null for no chosen initial value (all options inactive)
getter/setter pair
isVertical bool
Use toggle switch vertically
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
labels List<String>?
List of labels
final
minHeight double
Minimum switch height
final
minWidth double
Minimum switch width
final
multiLineText bool
Set multi-line text
final
onToggle OnToggle?
OnToggle function
final
radiusStyle bool
Set radius style
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
states List<bool>?
List of toggle states true:enabled; false:disabled
final
textDirectionRTL bool
Confirm if text direction is set right-to-left
final
totalSwitches int?
Total number of switches
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() → _ToggleSwitchState
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