CustomAnimatedToggleSwitch<T extends Object?> class
With this widget you can implement your own switches with nice animations.
For pre-made switches, please use the constructors of AnimatedToggleSwitch instead.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- CustomAnimatedToggleSwitch
Constructors
-
CustomAnimatedToggleSwitch({Key? key, required T current, required List<
T> values, required CustomIconBuilder<T> iconBuilder, Duration animationDuration = const Duration(milliseconds: 500), Curve animationCurve = Curves.easeInOutCirc, Size indicatorSize = const Size(48.0, double.infinity), ChangeCallback<T> ? onChanged, double spacing = 0.0, CustomSeparatorBuilder<T> ? separatorBuilder, TapCallback<T> ? onTap, FittingMode fittingMode = FittingMode.preventHorizontalOverlapping, CustomWrapperBuilder<T> ? wrapperBuilder, CustomIndicatorBuilder<T> ? foregroundIndicatorBuilder, CustomIndicatorBuilder<T> ? backgroundIndicatorBuilder, IndicatorAppearingBuilder indicatorAppearingBuilder = _defaultIndicatorAppearingBuilder, double height = 50.0, IconArrangement iconArrangement = IconArrangement.row, bool iconsTappable = true, EdgeInsetsGeometry padding = EdgeInsets.zero, double minTouchTargetSize = 48.0, Duration dragStartDuration = const Duration(milliseconds: 200), Curve dragStartCurve = Curves.easeInOutCirc, TextDirection? textDirection, ToggleCursors cursors = const ToggleCursors(), bool? loading, Duration? loadingAnimationDuration, Curve? loadingAnimationCurve, Duration indicatorAppearingDuration = _defaultIndicatorAppearingAnimationDuration, Curve indicatorAppearingCurve = _defaultIndicatorAppearingAnimationCurve, bool allowUnlistedValues = false, bool active = true, PositionListener<T> ? positionListener}) -
const
Properties
- active → bool
-
Indicates if the switch is active.
final
- allowUnlistedValues → bool
-
Indicates if an error should be thrown if current is not in values.
final
- animationCurve → Curve
-
Curve of the motion animation.
final
- animationDuration → Duration
-
Duration of the motion animation.
final
-
backgroundIndicatorBuilder
→ CustomIndicatorBuilder<
T> ? -
A builder for an indicator which is in behind the icons.
final
- current → T
-
The currently selected value. It has to be set at onChanged or whenever for animating to this value.
final
- cursors → ToggleCursors
-
The MouseCursor settings for this switch.
final
- dragStartCurve → Curve
-
The curve for the animation to the thumb when the user starts dragging.
final
- dragStartDuration → Duration
-
The duration for the animation to the thumb when the user starts dragging.
final
- fittingMode → FittingMode
-
The FittingMode of the switch.
final
-
foregroundIndicatorBuilder
→ CustomIndicatorBuilder<
T> ? -
A builder for an indicator which is in front of the icons.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- height → double
-
The height of the whole switch including wrapper.
final
- iconArrangement → IconArrangement
-
Indicates if the icons should overlap.
final
-
iconBuilder
→ CustomIconBuilder<
T> -
The builder for all icons.
final
- iconsTappable → bool
-
Indicates if onChanged is called when an icon is tapped.
final
- indicatorAppearingBuilder → IndicatorAppearingBuilder
-
Custom builder for the appearing animation of the indicator.
final
- indicatorAppearingCurve → Curve
-
Curve of the appearing animation.
final
- indicatorAppearingDuration → Duration
-
Duration of the appearing animation.
final
- indicatorSize → Size
-
Size of the indicator.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- loading → bool?
-
Indicates if the switch is currently loading.
final
- loadingAnimationCurve → Curve?
-
Curve of the loading animation.
final
- loadingAnimationDuration → Duration?
-
Duration of the loading animation.
final
- minTouchTargetSize → double
-
The minimum width of the indicator's hitbox.
final
-
onChanged
→ ChangeCallback<
T> ? -
Callback for selecting a new value. The new current should be set here.
final
-
onTap
→ TapCallback<
T> ? -
Callback for tapping anywhere on the widget.
final
- padding → EdgeInsetsGeometry
-
A padding between wrapper and icons/indicator.
final
-
positionListener
→ PositionListener<
T> ? -
Listener for the current position and ToggleMode of the indicator.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
separatorBuilder
→ CustomSeparatorBuilder<
T> ? -
Builder for divider or other separators between the icons.
Builder for divider or other separators between the icons.
final
- spacing → double
-
Space between adjacent icons.
final
- textDirection → TextDirection?
-
The direction in which the icons are arranged.
final
-
values
→ List<
T> -
All selectable values.
final
-
wrapperBuilder
→ CustomWrapperBuilder<
T> ? -
The builder for the wrapper around the switch.
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< CustomAnimatedToggleSwitch< T> > -
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