GFToggle class

A toggle button allows the user to change a setting between two states.

The state of each button is controlled by isSelected, which is a list of bools that determine if a button is in an unselected or selected state. They are both correlated by their index in the list. The length of isSelected has to match the length of the children list.

Customizing toggle buttons

Each toggle's behavior can be configured by the onPressed callback, which can update the isSelected list however it wants to.

Inheritance

Constructors

GFToggle({Key? key, required ValueChanged<bool?> onChanged, required bool value, String? enabledText, String? disabledText, TextStyle? enabledTextStyle, Color? enabledThumbColor, Color? enabledTrackColor, TextStyle? disabledTextStyle, Color? disabledTrackColor, Color? disabledThumbColor, GFToggleType? type, BoxShape? boxShape, BorderRadius? borderRadius, Duration duration = const Duration(milliseconds: 400)})
Creates toggle button to switch between states onChanged.
const

Properties

borderRadius BorderRadius?
type of BorderRadius used to define the radius of the Container
final
boxShape BoxShape?
type of BoxShape used to define shapes i.e, Circle , Rectangle
final
disabledText String?
type String used to add custom text i.e, ON,DISABLE please add only 4 character in this string.
final
disabledTextStyle TextStyle?
type of TextStyle used to define the style peoperties of the disabled text
final
disabledThumbColor Color?
type of Color used for the inactive thumb color
final
disabledTrackColor Color?
type of Color used for the inactive thumb color
final
duration Duration
type of animation Duration called when the switch animates during the specific duration
final
enabledText String?
type String used to add custom text i.e, ON,ENABLE please add only 4 character in this string.
final
enabledTextStyle TextStyle?
type of TextStyle used to define the style properties of the enabled text
final
enabledThumbColor Color?
type of Color used for the active thumb color
final
enabledTrackColor Color?
type of Color used for the active track color
final
hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
onChanged ValueChanged<bool?>
Called when the user toggles the switch on or off.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
type GFToggleType?
Button type of GFToggleType i.e, android, ios, custom, sqaure
final
value bool
This property must not be null. Used to set the current state of toggle
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() → _GFToggleState
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, int wrapWidth = 65}) 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