FlutterSwitch class
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- FlutterSwitch
Constructors
-
FlutterSwitch({Key? key, required bool value, required ValueChanged<
bool> onToggle, Color activeColor = Colors.blue, Color inactiveColor = Colors.grey, Color activeTextColor = Colors.white70, Color inactiveTextColor = Colors.white70, Color toggleColor = Colors.white, Color? activeToggleColor, Color? inactiveToggleColor, double width = 70.0, double height = 35.0, double toggleSize = 25.0, double valueFontSize = 16.0, double borderRadius = 20.0, double padding = 4.0, bool showOnOff = false, String? activeText, String? inactiveText, FontWeight? activeTextFontWeight, FontWeight? inactiveTextFontWeight, BoxBorder? switchBorder, BoxBorder? activeSwitchBorder, BoxBorder? inactiveSwitchBorder, BoxBorder? toggleBorder, BoxBorder? activeToggleBorder, BoxBorder? inactiveToggleBorder, Widget? activeIcon, Widget? inactiveIcon, Duration duration = const Duration(milliseconds: 200), bool disabled = false}) -
Creates a material design switch.
const
Properties
- activeColor → Color
-
The color to use on the switch when the switch is on.
final
- activeIcon → Widget?
-
The icon inside the toggle when the given value is true.
activeIcon can be an Icon Widget, an Image or Fontawesome Icons.
final
- activeSwitchBorder → BoxBorder?
-
The border of the switch when the given value is true.
final
- activeText → String?
-
The text to display when the switch is on.
This parameter is only necessary when showOnOff property is true.
final
- activeTextColor → Color
-
The color to use on the text value when the switch is on.
This parameter is only necessary when showOnOff property is true.
final
- activeTextFontWeight → FontWeight?
-
The font weight to use on the text value when the switch is on.
This parameter is only necessary when showOnOff property is true.
final
- activeToggleBorder → BoxBorder?
-
The border of the toggle when the given value is true.
final
- activeToggleColor → Color?
-
The color to use on the toggle of the switch when the given value is true.
final
- borderRadius → double
-
The border radius of the switch.
final
- disabled → bool
-
Determines whether the switch is disabled.
final
- duration → Duration
-
The duration in milliseconds to change the state of the switch
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- height → double
-
The given height of the switch.
final
- inactiveColor → Color
-
The color to use on the switch when the switch is off.
final
- inactiveIcon → Widget?
-
The icon inside the toggle when the given value is false.
inactiveIcon can be an Icon Widget, an Image or Fontawesome Icons.
final
- inactiveSwitchBorder → BoxBorder?
-
The border of the switch when the given value is false.
final
- inactiveText → String?
-
The text to display when the switch is off.
This parameter is only necessary when showOnOff property is true.
final
- inactiveTextColor → Color
-
The color to use on the text value when the switch is off.
This parameter is only necessary when showOnOff property is true.
final
- inactiveTextFontWeight → FontWeight?
-
The font weight to use on the text value when the switch is off.
This parameter is only necessary when showOnOff property is true.
final
- inactiveToggleBorder → BoxBorder?
-
The border of the toggle when the given value is false.
final
- inactiveToggleColor → Color?
-
The color to use on the toggle of the switch when the given value is false.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
-
onToggle
→ ValueChanged<
bool> -
Called when the user toggles the switch.
final
- padding → double
-
The padding of the switch.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- showOnOff → bool
-
Displays an on or off text.
final
- switchBorder → BoxBorder?
-
The border of the switch.
final
- toggleBorder → BoxBorder?
-
The border of the toggle.
final
- toggleColor → Color
-
The color to use on the toggle of the switch.
final
- toggleSize → double
-
The size of the toggle of the switch.
final
- value → bool
-
Determines if the switch is on or off.
final
- valueFontSize → double
-
The font size of the values of the switch.
This parameter is only necessary when showOnOff property is true.
final
- width → double
-
The given width of the switch.
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → FlutterSwitchState -
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