Switcher class
A Switcher
widget to usage for input bool values.
The Switcher requests a callback Function(bool)
named as onChange which
will be triggered after the inner control value changed.
If the onChange function is absent, an assertion error will be throw.
assert(onChange != null);
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- Switcher
Constructors
- Switcher({required bool value, required void onChange(bool value), Duration duration = const Duration(milliseconds: 100), double size = 24.0, Color? activeColor, Color? disableColor})
-
The default Switcher constructor that render a square shaped
Switcher
. - Switcher.label({required bool value, required void onChange(bool value), required String? label, TextStyle? labelStyle = const TextStyle(), MainAxisAlignment mainAxisAlignment = MainAxisAlignment.spaceBetween, Duration duration = const Duration(milliseconds: 100), double size = 24.0, Color? activeColor, Color? disableColor})
-
The named constructor called label that render a square shaped
Switcher
with alabel
. - Switcher.labelAndRounded({required bool value, required void onChange(bool value), required String? label, TextStyle? labelStyle = const TextStyle(), MainAxisAlignment mainAxisAlignment = MainAxisAlignment.spaceBetween, Duration duration = const Duration(milliseconds: 100), double size = 24.0, Color? activeColor, Color? disableColor})
-
The named constructor called label that render a circle shaped
Switcher
with alabel
. - Switcher.rounded({required bool value, required void onChange(bool value), Duration duration = const Duration(milliseconds: 100), double size = 24.0, Color? activeColor, Color? disableColor})
-
The named constructor called rounded that render a circle shaped
Switcher
.
Properties
- activeColor → Color?
-
The active Color of the
Switcher
. Is displayed when the inner control value is equal totrue
. The default value is:final - disableColor → Color?
-
The disable Color of the
Switcher
. Is displayed when the inner control value is equal tofalse
. The default value is:final - duration → Duration
-
The Duration of the
Switcher
animation on value changed. The default value is:final - hashCode → int
-
The hash code for this object.
no setterinherited
- hasLabel → bool
-
of
selected
tovalue
if is provided.no setter - key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- label ↔ String?
-
The
text
displayed by thelabel
.getter/setter pair - labelStyle ↔ TextStyle?
-
The
style
for thelabel
.getter/setter pair - mainAxisAlignment ↔ MainAxisAlignment
-
The
alignment
for the row that contains thelabel
and theSwitcher
.getter/setter pair - onChange → void Function(bool value)
-
The callback function reference that is called after
the
Switcher
value changes. Triggered when the inner control value is changed.final - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- size → double
-
The size of
Switcher
.final - switcherWidget → Widget
-
no setter
- value → bool
-
The bool value for
Switcher
.final
Methods
-
build(
BuildContext context) → Widget -
Describes the part of the user interface represented by this widget.
override
-
buildSwitcherWithLabel(
BuildContext context) → Widget - Method that return a Row with the label (Text) and the Switcher.
-
createElement(
) → StatelessElement -
Creates a StatelessElement to manage this widget's location in the tree.
inherited
-
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