AnimatedToggleSwitch<T> class Null safety

Inheritance

Constructors

AnimatedToggleSwitch.custom({Key? key, required T current, required List<T> values, AnimatedIconBuilder<T>? animatedIconBuilder, Duration animationDuration = const Duration(milliseconds: 500), Curve animationCurve = Curves.easeInOutCirc, Size indicatorSize = const Size(48.0, double.infinity), dynamic onChanged(T)?, double borderWidth = 2, Color? borderColor, Color? innerColor, Color? indicatorColor, ColorBuilder<T>? colorBuilder, Curve iconAnimationCurve = Curves.easeOutBack, Duration? iconAnimationDuration, double iconOpacity = 0.5, BorderRadiusGeometry? borderRadius, double dif = 0.0, CustomIndicatorBuilder<T>? foregroundIndicatorIconBuilder, double selectedIconOpacity = 1.0, double height = 50.0, ColorBuilder<T>? borderColorBuilder, AnimationType iconAnimationType = AnimationType.onSelected, AnimationType indicatorAnimationType = AnimationType.onSelected, dynamic onTap()?, FittingMode fittingMode = FittingMode.preventHorizontalOverlapping, BoxBorder? indicatorBorder, List<BoxShadow> foregroundBoxShadow = const [], List<BoxShadow> boxShadow = const [], double minTouchTargetSize = 48.0, TextDirection? textDirection, BorderRadiusGeometry? indicatorBorderRadius, bool iconsTappable = true, MouseCursor? defaultCursor, MouseCursor draggingCursor = SystemMouseCursors.grabbing, MouseCursor dragCursor = SystemMouseCursors.grab})
Constructor of AnimatedToggleSwitch with all possible settings.
const
AnimatedToggleSwitch.customByHeight({Key? key, double height = 50.0, required T current, required List<T> values, AnimatedIconBuilder<T>? animatedIconBuilder, Duration animationDuration = const Duration(milliseconds: 500), Curve animationCurve = Curves.easeInOutCirc, Size indicatorSize = const Size(1.0, 1.0), dynamic onChanged(T)?, double borderWidth = 2, Color? borderColor, Color? innerColor, Color? indicatorColor, ColorBuilder<T>? colorBuilder, Curve iconAnimationCurve = Curves.easeOutBack, Duration? iconAnimationDuration, double iconOpacity = 0.5, BorderRadiusGeometry? borderRadius, dynamic dif = 0.0, CustomIndicatorBuilder<T>? foregroundIndicatorIconBuilder, double selectedIconOpacity = 1.0, ColorBuilder<T>? borderColorBuilder, AnimationType iconAnimationType = AnimationType.onSelected, AnimationType indicatorAnimationType = AnimationType.onSelected, dynamic onTap()?, FittingMode fittingMode = FittingMode.preventHorizontalOverlapping, BoxBorder? indicatorBorder, List<BoxShadow> foregroundBoxShadow = const [], List<BoxShadow> boxShadow = const [], double minTouchTargetSize = 48.0, TextDirection? textDirection, BorderRadiusGeometry? indicatorBorderRadius, bool iconsTappable = true, MouseCursor? defaultCursor, MouseCursor draggingCursor = SystemMouseCursors.grabbing, MouseCursor dragCursor = SystemMouseCursors.grab})
Another version of AnimatedToggleSwitch.custom.
const
AnimatedToggleSwitch.dual({Key? key, required T current, required T first, required T second, SimpleIconBuilder<T>? iconBuilder, IconBuilder<T>? customIconBuilder, SimpleIconBuilder<T>? textBuilder, AnimatedIconBuilder<T>? customTextBuilder, Duration animationDuration = const Duration(milliseconds: 500), Curve animationCurve = Curves.easeInOutCirc, Size indicatorSize = const Size(46.0, double.infinity), dynamic onChanged(T)?, double borderWidth = 2, Color? borderColor, Color? innerColor, Color? indicatorColor, ColorBuilder<T>? colorBuilder, double iconRadius = 16.1, BorderRadiusGeometry? borderRadius, double dif = 40.0, double height = 50.0, Duration? iconAnimationDuration = const Duration(milliseconds: 500), Curve iconAnimationCurve = Curves.easeInOut, ColorBuilder<T>? borderColorBuilder, AnimationType indicatorAnimationType = AnimationType.onHover, FittingMode fittingMode = FittingMode.preventHorizontalOverlapping, dynamic onTap()?, BoxBorder? indicatorBorder, List<BoxShadow> foregroundBoxShadow = const [], List<BoxShadow> boxShadow = const [], double minTouchTargetSize = 48.0, TextDirection? textDirection, BorderRadiusGeometry? indicatorBorderRadius, MouseCursor? defaultCursor = SystemMouseCursors.click, MouseCursor draggingCursor = SystemMouseCursors.grabbing, MouseCursor dragCursor = SystemMouseCursors.grab, EdgeInsetsGeometry textMargin = const EdgeInsets.symmetric(horizontal: 8.0), Offset animationOffset = const Offset(20.0, 0), bool clipAnimation = true, bool opacityAnimation = true})
Defining an rolling animation using the foregroundIndicatorIconBuilder of AnimatedToggleSwitch.
AnimatedToggleSwitch.rolling({Key? key, required T current, required List<T> values, SimpleRollingIconBuilder<T>? iconBuilder, RollingIconBuilder<T>? customIconBuilder, Duration animationDuration = const Duration(milliseconds: 500), Curve animationCurve = Curves.easeInOutCirc, Size indicatorSize = const Size(46.0, double.infinity), dynamic onChanged(T)?, double borderWidth = 2, Color? borderColor, Color? innerColor, Color? indicatorColor, ColorBuilder<T>? colorBuilder, double iconRadius = 11.5, double selectedIconRadius = 16.1, double iconOpacity = 0.5, BorderRadiusGeometry? borderRadius, double dif = 0.0, double height = 50.0, ColorBuilder<T>? borderColorBuilder, AnimationType indicatorAnimationType = AnimationType.onSelected, dynamic onTap()?, FittingMode fittingMode = FittingMode.preventHorizontalOverlapping, BoxBorder? indicatorBorder, List<BoxShadow> foregroundBoxShadow = const [], List<BoxShadow> boxShadow = const [], double minTouchTargetSize = 48.0, TextDirection? textDirection, BorderRadiusGeometry? indicatorBorderRadius, bool iconsTappable = true, MouseCursor? defaultCursor, MouseCursor draggingCursor = SystemMouseCursors.grabbing, MouseCursor dragCursor = SystemMouseCursors.grab})
Defining a rolling animation using the foregroundIndicatorIconBuilder of AnimatedToggleSwitch.
AnimatedToggleSwitch.rollingByHeight({Key? key, double height = 50.0, required T current, required List<T> values, SimpleRollingIconBuilder<T>? iconBuilder, RollingIconBuilder<T>? customIconBuilder, Duration animationDuration = const Duration(milliseconds: 500), Curve animationCurve = Curves.easeInOutCirc, Size indicatorSize = const Size(1.0, 1.0), dynamic onChanged(T)?, double borderWidth = 2, Color? borderColor, Color? innerColor, Color? indicatorColor, ColorBuilder<T>? colorBuilder, double iconRadius = 0.25, double selectedIconRadius = 0.35, double iconOpacity = 0.5, BorderRadiusGeometry? borderRadius, double dif = 0.0, ColorBuilder<T>? borderColorBuilder, AnimationType indicatorAnimationType = AnimationType.onSelected, dynamic onTap()?, FittingMode fittingMode = FittingMode.preventHorizontalOverlapping, BoxBorder? indicatorBorder, List<BoxShadow> foregroundBoxShadow = const [], List<BoxShadow> boxShadow = const [], double minTouchTargetSize = 48.0, TextDirection? textDirection, BorderRadiusGeometry? indicatorBorderRadius, bool iconsTappable = true, MouseCursor? defaultCursor, MouseCursor draggingCursor = SystemMouseCursors.grabbing, MouseCursor dragCursor = SystemMouseCursors.grab})
Special version of AnimatedToggleSwitch.customByHeight.
AnimatedToggleSwitch.size({Key? key, required T current, required List<T> values, SimpleSizeIconBuilder<T>? iconBuilder, SizeIconBuilder<T>? customIconBuilder, Duration animationDuration = const Duration(milliseconds: 500), Curve animationCurve = Curves.easeInOutCirc, Size indicatorSize = const Size(48.0, double.infinity), dynamic onChanged(T)?, double borderWidth = 2, Color? borderColor, Color? innerColor, Color? indicatorColor, ColorBuilder<T>? colorBuilder, dynamic iconSize = const Size(23.0, 23.0), dynamic selectedIconSize = const Size(34.5, 34.5), Curve iconAnimationCurve = Curves.easeOutBack, Duration? iconAnimationDuration, double iconOpacity = 0.5, BorderRadiusGeometry? borderRadius, double dif = 0.0, CustomIndicatorBuilder<T>? foregroundIndicatorIconBuilder, double selectedIconOpacity = 1.0, double height = 50.0, ColorBuilder<T>? borderColorBuilder, AnimationType iconAnimationType = AnimationType.onSelected, AnimationType indicatorAnimationType = AnimationType.onSelected, dynamic onTap()?, FittingMode fittingMode = FittingMode.preventHorizontalOverlapping, BoxBorder? indicatorBorder, List<BoxShadow> foregroundBoxShadow = const [], List<BoxShadow> boxShadow = const [], double minTouchTargetSize = 48.0, TextDirection? textDirection, BorderRadiusGeometry? indicatorBorderRadius, bool iconsTappable = true, MouseCursor? defaultCursor, MouseCursor draggingCursor = SystemMouseCursors.grabbing, MouseCursor dragCursor = SystemMouseCursors.grab})
Provides an AnimatedToggleSwitch with the standard size animation of the icons.
AnimatedToggleSwitch.sizeByHeight({Key? key, double height = 50.0, required T current, required List<T> values, Duration animationDuration = const Duration(milliseconds: 500), Curve animationCurve = Curves.easeInOutCirc, Size indicatorSize = const Size(1.0, 1.0), SimpleSizeIconBuilder<T>? iconBuilder, SizeIconBuilder<T>? customIconBuilder, dynamic onChanged(T)?, double borderWidth = 2, Color? borderColor, Color? innerColor, Color? indicatorColor, ColorBuilder<T>? colorBuilder, dynamic iconSize = const Size(0.5, 0.5), dynamic selectedIconSize = const Size(0.75, 0.75), Curve iconAnimationCurve = Curves.easeOutBack, Duration? iconAnimationDuration, double iconOpacity = 0.5, BorderRadiusGeometry? borderRadius, dynamic dif = 0.0, CustomIndicatorBuilder<T>? foregroundIndicatorIconBuilder, double selectedIconOpacity = 1.0, ColorBuilder<T>? borderColorBuilder, AnimationType iconAnimationType = AnimationType.onSelected, AnimationType indicatorAnimationType = AnimationType.onSelected, dynamic onTap()?, FittingMode fittingMode = FittingMode.preventHorizontalOverlapping, BoxBorder? indicatorBorder, List<BoxShadow> foregroundBoxShadow = const [], List<BoxShadow> boxShadow = const [], double minTouchTargetSize = 48.0, TextDirection? textDirection, BorderRadiusGeometry? indicatorBorderRadius, bool iconsTappable = true, MouseCursor? defaultCursor, MouseCursor draggingCursor = SystemMouseCursors.grabbing, MouseCursor dragCursor = SystemMouseCursors.grab})
All size values (indicatorWidth, iconSize, selectedIconSize) are relative to the specified height. (So an indicatorWidth of 1.0 means equality of height - 2*borderWidth and indicatorWidth)

Properties

animatedIconBuilder AnimatedIconBuilder<T>?
The IconBuilder for all icons with the specified size.
final
animationCurve Curve
Curve of the motion animation.
final
animationDuration Duration
Duration of the motion animation.
final
borderColor Color?
Standard color of the border of the switch. For deactivating please set this to Colors.transparent and set borderWidth to 0.0.
final
borderColorBuilder ColorBuilder<T>?
A builder for the Color of the Border. Can be used alternatively to borderColor.
final
borderRadius BorderRadiusGeometry?
BorderRadius of the border. If this is null, the standard BorderRadius is taken.
final
borderWidth double
Width of the border of the switch. For deactivating please set this to 0.0 and set borderColor to Colors.transparent.
final
boxShadow List<BoxShadow>
Shadow for the Container in the background.
final
colorBuilder ColorBuilder<T>?
Builder for the color of the indicator depending on the current value.
final
current → T
The currently selected value. It has to be set at onChanged or whenever for animating to this value.
final
defaultCursor MouseCursor?
MouseCursor to show when not hovering an indicator.
final
dif double
Space between the "indicator rooms" of the adjacent icons.
final
dragCursor MouseCursor
MouseCursor to show when hovering the indicators.
final
draggingCursor MouseCursor
MouseCursor to show when grabbing the indicators.
final
fittingMode FittingMode
The FittingMode of the switch.
final
foregroundBoxShadow List<BoxShadow>
Shadow for the indicator Container.
final
foregroundIndicatorIconBuilder CustomIndicatorBuilder<T>?
If null, the indicator is behind the icons. Otherwise an icon is in the indicator and is built using this Function.
final
hashCode int
The hash code for this object.
@nonVirtualread-onlyinherited
height double
Total height of the widget.
final
iconAnimationCurve Curve
iconAnimationCurve defines the duration of the Animation built in animatedIconBuilder. In some constructors this is the Curve of the size animation.
final
iconAnimationDuration Duration?
If null, animationDuration is taken.
final
iconAnimationType AnimationType
Which iconAnimationType for the animatedIconBuilder should be taken?
final
iconOpacity double
Opacity for the icons.
final
iconsTappable bool
Indicates if onChanged is called when an icon is tapped. If false the user can change the value only by dragging the indicator.
final
indicatorAnimationType AnimationType
Which iconAnimationType for the indicator should be taken?
final
indicatorBorder BoxBorder?
final
indicatorBorderRadius BorderRadiusGeometry?
BorderRadius of the indicator. Defaults to borderRadius.
final
indicatorColor Color?
Standard Indicator Color
final
indicatorSize Size
Size of the indicator.
final
innerColor Color?
Color of the background.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
minTouchTargetSize double
The minimum width of the indicator's hitbox.
final
onChanged → (dynamic Function?(T)?)
Callback for selecting a new value. The new current should be set here.
final
onTap → (dynamic Function?()?)
Callback for tapping anywhere on the widget.
final
runtimeType Type
A representation of the runtime type of the object.
read-onlyinherited
selectedIconOpacity double
Opacity for the currently selected icon.
final
textDirection TextDirection?
The direction in which the icons are arranged.
final
values List<T>
All possible values.
final

Methods

build(BuildContext context) Widget
Describes the part of the user interface represented by this widget.
override
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.
@protectedinherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent 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.
@nonVirtualinherited