AnimatedToggleSwitch<T extends Object?>.customByHeight constructor

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

Special version of AnimatedToggleSwitch.custom.

All size values (indicatorSize, spacing) are relative to the specified height. (So an indicatorSize.width of 1.0 means equality of height - 2*borderWidth and the width of the indicator)

Consider using CustomAnimatedToggleSwitch for maximum customizability.

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

Implementation

const AnimatedToggleSwitch.customByHeight({
  super.key,
  this.height = 50.0,
  required this.current,
  required this.values,
  this.animatedIconBuilder,
  this.animationDuration = const Duration(milliseconds: 500),
  this.animationCurve = Curves.easeInOutCirc,
  Size indicatorSize = const Size(1.0, 1.0),
  this.onChanged,
  this.borderWidth = 2.0,
  this.style = const ToggleStyle(),
  this.styleBuilder,
  this.customStyleBuilder,
  this.styleList,
  this.iconAnimationCurve = Curves.easeOutBack,
  this.iconAnimationDuration,
  this.iconOpacity = 0.5,
  double spacing = 0.0,
  this.foregroundIndicatorIconBuilder,
  this.selectedIconOpacity = 1.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,
})  : spacing = spacing * (height - 2 * borderWidth),
      indicatorSize = indicatorSize * (height - 2 * borderWidth),
      _iconArrangement = IconArrangement.row,
      super(
        values: values,
        styleBuilder: styleBuilder,
        customStyleBuilder: customStyleBuilder,
        styleList: styleList,
        iconList: null,
      );