AnimatedToggleSwitch<T extends Object?>.size constructor

AnimatedToggleSwitch<T extends Object?>.size({
  1. Key? key,
  2. required T current,
  3. required List<T> values,
  4. SimpleIconBuilder<T>? iconBuilder,
  5. AnimatedIconBuilder<T>? customIconBuilder,
  6. List<Widget>? iconList,
  7. Duration animationDuration = const Duration(milliseconds: 500),
  8. Curve animationCurve = Curves.easeInOutCirc,
  9. Size indicatorSize = const Size.fromWidth(48.0),
  10. ChangeCallback<T>? onChanged,
  11. double borderWidth = 2.0,
  12. ToggleStyle style = const ToggleStyle(),
  13. StyleBuilder<T>? styleBuilder,
  14. CustomStyleBuilder<T>? customStyleBuilder,
  15. List<ToggleStyle>? styleList,
  16. double selectedIconScale = sqrt2,
  17. Curve iconAnimationCurve = Curves.easeOutBack,
  18. Duration? iconAnimationDuration,
  19. double iconOpacity = 0.5,
  20. double selectedIconOpacity = 1.0,
  21. double spacing = 0.0,
  22. CustomIndicatorBuilder<T>? foregroundIndicatorIconBuilder,
  23. double height = 50.0,
  24. AnimationType iconAnimationType = AnimationType.onSelected,
  25. AnimationType styleAnimationType = AnimationType.onSelected,
  26. AnimationType indicatorAnimationType = AnimationType.onHover,
  27. TapCallback<T>? onTap,
  28. FittingMode fittingMode = FittingMode.preventHorizontalOverlapping,
  29. double minTouchTargetSize = 48.0,
  30. TextDirection? textDirection,
  31. bool iconsTappable = true,
  32. ToggleCursors cursors = const ToggleCursors(),
  33. LoadingIconBuilder<T> loadingIconBuilder = _defaultLoadingIconBuilder,
  34. bool? loading,
  35. Duration? loadingAnimationDuration,
  36. Curve? loadingAnimationCurve,
  37. bool allowUnlistedValues = false,
  38. IndicatorAppearingBuilder indicatorAppearingBuilder = _defaultIndicatorAppearingBuilder,
  39. Duration indicatorAppearingDuration = _defaultIndicatorAppearingAnimationDuration,
  40. Curve indicatorAppearingCurve = _defaultIndicatorAppearingAnimationCurve,
  41. SeparatorBuilder? separatorBuilder,
  42. CustomSeparatorBuilder<T>? customSeparatorBuilder,
  43. bool active = true,
  44. double inactiveOpacity = 0.6,
  45. Curve inactiveOpacityCurve = Curves.easeInOut,
  46. Duration inactiveOpacityDuration = const Duration(milliseconds: 350),
  47. PositionListener<T>? positionListener,
  48. Clip clipBehavior = Clip.antiAlias,
})

Provides an AnimatedToggleSwitch with the standard size animation of the icons.

Maximum one argument of iconBuilder, customIconBuilder and iconList must be provided.

Maximum one argument of styleBuilder, customStyleBuilder and styleList must be provided.

Implementation

AnimatedToggleSwitch.size({
  super.key,
  required this.current,
  required this.values,
  SimpleIconBuilder<T>? iconBuilder,
  AnimatedIconBuilder<T>? customIconBuilder,
  List<Widget>? iconList,
  this.animationDuration = const Duration(milliseconds: 500),
  this.animationCurve = Curves.easeInOutCirc,
  this.indicatorSize = const Size.fromWidth(48.0),
  this.onChanged,
  this.borderWidth = 2.0,
  this.style = const ToggleStyle(),
  this.styleBuilder,
  this.customStyleBuilder,
  this.styleList,
  double selectedIconScale = sqrt2,
  this.iconAnimationCurve = Curves.easeOutBack,
  this.iconAnimationDuration,
  this.iconOpacity = 0.5,
  this.selectedIconOpacity = 1.0,
  this.spacing = 0.0,
  this.foregroundIndicatorIconBuilder,
  this.height = 50.0,
  this.iconAnimationType = AnimationType.onSelected,
  this.styleAnimationType = AnimationType.onSelected,
  this.indicatorAnimationType = AnimationType.onHover,
  this.onTap,
  this.fittingMode = FittingMode.preventHorizontalOverlapping,
  this.minTouchTargetSize = 48.0,
  this.textDirection,
  this.iconsTappable = true,
  this.cursors = const ToggleCursors(),
  this.loadingIconBuilder = _defaultLoadingIconBuilder,
  this.loading,
  this.loadingAnimationDuration,
  this.loadingAnimationCurve,
  this.allowUnlistedValues = false,
  this.indicatorAppearingBuilder = _defaultIndicatorAppearingBuilder,
  this.indicatorAppearingDuration =
      _defaultIndicatorAppearingAnimationDuration,
  this.indicatorAppearingCurve = _defaultIndicatorAppearingAnimationCurve,
  this.separatorBuilder,
  this.customSeparatorBuilder,
  this.active = true,
  this.inactiveOpacity = 0.6,
  this.inactiveOpacityCurve = Curves.easeInOut,
  this.inactiveOpacityDuration = const Duration(milliseconds: 350),
  this.positionListener,
  this.clipBehavior = Clip.antiAlias,
})  : animatedIconBuilder = _iconSizeBuilder<T>(
          iconBuilder, customIconBuilder, iconList, selectedIconScale),
      _iconArrangement = IconArrangement.row,
      super(
        values: values,
        styleBuilder: styleBuilder,
        customStyleBuilder: customStyleBuilder,
        styleList: styleList,
        iconList: iconList,
      );