RollingSwitch class
The main widget to show a rolling widget Customable and attractive Switch button.
RollingSwitch.icon(
onChanged: (bool state) {
print('turned ${(state) ? 'on' : 'off'}');
},
rollingInfoRight: const RollingIconInfo(
icon: Icons.flag,
text: Text('Flag'),
),
rollingInfoLeft: const RollingIconInfo(
icon: Icons.check,
backgroundColor: Colors.grey,
text: Text('Check'),
),
)
The only required value is:
- onChanged is called when the user toggles the switch left or right
Available constructors:
- RollingSwitch.icon: Create a Rolling with flutter icons
- RollingSwitch.widget: Create a Rolling with custom widget
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- RollingSwitch
Constructors
- RollingSwitch.icon({Key? key, required dynamic onChanged(bool), RollingIconInfo rollingInfoRight = const RollingIconInfo(icon: Icons.flag), RollingIconInfo rollingInfoLeft = const RollingIconInfo(icon: Icons.check, backgroundColor: Colors.grey), bool initialState = false, double width = 130, double height = 50, double innerSize = 40, Color circularColor = Colors.white, bool enableDrag = false, Duration animationDuration = const Duration(milliseconds: 400), Function? onTap})
-
const
- RollingSwitch.widget({Key? key, required dynamic onChanged(bool), RollingWidgetInfo rollingInfoRight = const RollingWidgetInfo(), RollingWidgetInfo rollingInfoLeft = const RollingWidgetInfo(backgroundColor: Colors.grey), bool initialState = false, double width = 130, double height = 50, double innerSize = 40, Color circularColor = Colors.white, bool enableDrag = false, Duration animationDuration = const Duration(milliseconds: 400), Function? onTap})
-
const
Properties
- animationDuration → Duration
-
animationDuration animation duration
final
- circularColor → Color
-
circularColor color for the circular icon wrapper
final
- enableDrag → bool
-
enableDrag enable the drag event, for the moment only can use drag or tap
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- height → double
-
height height size
final
- initialState → bool
-
initialState determines whether this switch is left or right
final
- innerSize → double
-
innerSize helper to change size of icon and elements into the rolling switch
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- onChanged → dynamic Function(bool)
-
onChanged is called when the user toggles the switch left or right
final
- onTap → Function?
-
onTap function callback when tap is called
final
- rollingInfoLeft → RollingInfo
-
rollingInfoLeft configure the infor for the when icon is in left
final
- rollingInfoRight → RollingInfo
-
rollingInfoRight configure the infor for the when icon is in right
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- width → double
-
width width size
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → _RollingSwitchState -
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