LoadSwitch class

Inheritance

Constructors

LoadSwitch({required bool value, required Future<bool> future(), required dynamic onChange(bool), required dynamic onTap(bool), SpinStyle style = SpinStyle.material, dynamic onError(Object)?, double width = 95, double height = 50, Color spinColor(bool value)?, double spinStrokeWidth = 2, double thumbSizeRatio = 1, Duration? animationDuration, Decoration thumbDecoration(bool value, bool isActive)?, Decoration switchDecoration(bool value, bool isActive)?, Curve? curveIn, Curve? curveOut, bool? isLoading, bool isActive = true, Key? key})
const

Properties

animationDuration Duration?
The duration of the switch animation. Defaults to 250ms.
final
curveIn Curve?
The curve of the switch animation when going in loading state.
final
curveOut Curve?
The curve of the switch animation when going out loading state.
final
future Future<bool> Function()
The main Future with bool return type, which triggers when tapping the switch.
final
hashCode int
The hash code for this object.
no setterinherited
height double
The height of the switch. Must be less or equal to width. Defaults to 50.
final
isActive bool
Whether the toggle is active or not. If null, the switch will be active.
final
isLoading bool?
Manually change the loading state of the switch.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
onChange → dynamic Function(bool)
The callback when future has finished loading. Returns the response bool of the future.
final
onError → (dynamic Function(Object)?)
The callback when an error occurs during the future execution.
final
onTap → dynamic Function(bool)
Tap callback which returns the current value of the switch.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
spinColor → (Color Function(bool value)?)
The color of the loading spinner.
final
spinStrokeWidth double
The width of the loading spinner. Defaults to 2.
final
style SpinStyle
The style of the loading spinner. Defaults to SpinStyle.material.
final
switchDecoration → (Decoration Function(bool value, bool isActive)?)
The decoration of the thumb.
final
thumbDecoration → (Decoration Function(bool value, bool isActive)?)
The decoration of the thumb.
final
thumbSizeRatio double
The ratio of the thumb size to the switch size. Defaults to 1.
final
value bool
Current value of the switch.
final
width double
The width of the switch. Must be greater or equal to height. Defaults to 95.
final

Methods

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