AnimatedToggleSwitch<T extends Object?>.sizeByHeight constructor
AnimatedToggleSwitch<T extends Object?>.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.square(1.0),
- SimpleIconBuilder<
T> ? iconBuilder, - AnimatedIconBuilder<
T> ? customIconBuilder, - List<
Widget> ? iconList, - ChangeCallback<
T> ? onChanged, - double borderWidth = 2.0,
- ToggleStyle style = const ToggleStyle(),
- StyleBuilder<
T> ? styleBuilder, - CustomStyleBuilder<
T> ? customStyleBuilder, - List<
ToggleStyle> ? styleList, - double selectedIconScale = sqrt2,
- Curve iconAnimationCurve = Curves.easeOutBack,
- Duration? iconAnimationDuration,
- double iconOpacity = 0.5,
- double spacing = 0.0,
- CustomIndicatorBuilder<
T> ? foregroundIndicatorIconBuilder, - double selectedIconOpacity = 1.0,
- AnimationType iconAnimationType = AnimationType.onSelected,
- AnimationType styleAnimationType = AnimationType.onSelected,
- AnimationType indicatorAnimationType = AnimationType.onHover,
- TapCallback<
T> ? onTap, - FittingMode fittingMode = FittingMode.preventHorizontalOverlapping,
- double minTouchTargetSize = 48.0,
- TextDirection? textDirection,
- bool iconsTappable = true,
- ToggleCursors cursors = const ToggleCursors(),
- LoadingIconBuilder<
T> loadingIconBuilder = _defaultLoadingIconBuilder, - bool? loading,
- Duration? loadingAnimationDuration,
- Curve? loadingAnimationCurve,
- bool allowUnlistedValues = false,
- IndicatorAppearingBuilder indicatorAppearingBuilder = _defaultIndicatorAppearingBuilder,
- Duration indicatorAppearingDuration = _defaultIndicatorAppearingAnimationDuration,
- Curve indicatorAppearingCurve = _defaultIndicatorAppearingAnimationCurve,
- SeparatorBuilder? separatorBuilder,
- CustomSeparatorBuilder<
T> ? customSeparatorBuilder, - bool active = true,
- double inactiveOpacity = 0.6,
- Curve inactiveOpacityCurve = Curves.easeInOut,
- Duration inactiveOpacityDuration = const Duration(milliseconds: 350),
- PositionListener<
T> ? positionListener,
Special version of AnimatedToggleSwitch.size.
All size values (indicatorSize
, iconSize
) 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)
Maximum one argument of iconBuilder
, customIconBuilder
and iconList
must be provided.
Maximum one argument of styleBuilder, customStyleBuilder and styleList must be provided.
Implementation
AnimatedToggleSwitch.sizeByHeight({
super.key,
this.height = 50.0,
required this.current,
required this.values,
this.animationDuration = const Duration(milliseconds: 500),
this.animationCurve = Curves.easeInOutCirc,
Size indicatorSize = const Size.square(1.0),
SimpleIconBuilder<T>? iconBuilder,
AnimatedIconBuilder<T>? customIconBuilder,
List<Widget>? iconList,
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,
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,
}) : indicatorSize = indicatorSize * (height - 2 * borderWidth),
spacing = spacing * (height - 2 * borderWidth),
animatedIconBuilder = _iconSizeBuilder<T>(
iconBuilder, customIconBuilder, iconList, selectedIconScale),
_iconArrangement = IconArrangement.row,
super(
values: values,
styleBuilder: styleBuilder,
customStyleBuilder: customStyleBuilder,
styleList: styleList,
iconList: iconList,
);