AnimatedToggleSwitch<T extends Object?>.rollingByHeight constructor
AnimatedToggleSwitch<T extends Object?>.rollingByHeight ({
- Key? key,
- double height = 50.0,
- required T current,
- required List<
T> values, - SimpleRollingIconBuilder<
T> ? iconBuilder, - RollingIconBuilder<
T> ? customIconBuilder, - List<
Widget> ? iconList, - Duration animationDuration = const Duration(milliseconds: 500),
- Curve animationCurve = Curves.easeInOutCirc,
- Size indicatorSize = const Size.square(1.0),
- ChangeCallback<
T> ? onChanged, - double borderWidth = 2.0,
- ToggleStyle style = const ToggleStyle(),
- StyleBuilder<
T> ? styleBuilder, - CustomStyleBuilder<
T> ? customStyleBuilder, - List<
ToggleStyle> ? styleList, - double iconOpacity = 0.5,
- double spacing = 0.0,
- 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,
- ForegroundIndicatorTransition indicatorTransition = const ForegroundIndicatorTransition.rolling(),
- 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, - Clip clipBehavior = Clip.antiAlias,
- double indicatorIconScale = 1.0,
Special version of AnimatedToggleSwitch.rolling.
All size values (spacing
, indicatorSize
, selectedIconSize
) 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)
indicatorIconScale
defines the scale of the indicator icon.
This is useful in combination with iconList
if you want the icons in the foreground to be slightly bigger.
Maximum one argument of iconBuilder
, customIconBuilder
and iconList
must be provided.
Maximum one argument of styleBuilder, customStyleBuilder and styleList must be provided.
Implementation
AnimatedToggleSwitch.rollingByHeight({
super.key,
this.height = 50.0,
required this.current,
required this.values,
SimpleRollingIconBuilder<T>? iconBuilder,
RollingIconBuilder<T>? customIconBuilder,
List<Widget>? iconList,
this.animationDuration = const Duration(milliseconds: 500),
this.animationCurve = Curves.easeInOutCirc,
Size indicatorSize = const Size.square(1.0),
this.onChanged,
this.borderWidth = 2.0,
this.style = const ToggleStyle(),
this.styleBuilder,
this.customStyleBuilder,
this.styleList,
this.iconOpacity = 0.5,
double spacing = 0.0,
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,
ForegroundIndicatorTransition indicatorTransition =
const ForegroundIndicatorTransition.rolling(),
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,
double indicatorIconScale = 1.0,
}) : iconAnimationCurve = Curves.linear,
spacing = spacing * (height - 2 * borderWidth),
iconAnimationDuration = Duration.zero,
indicatorSize = indicatorSize * (height - 2 * borderWidth),
selectedIconOpacity = iconOpacity,
iconAnimationType = AnimationType.onSelected,
foregroundIndicatorIconBuilder =
_rollingForegroundIndicatorIconBuilder<T>(
values,
iconBuilder,
customIconBuilder,
iconList,
height,
borderWidth,
indicatorTransition,
indicatorIconScale),
animatedIconBuilder = _standardIconBuilder(
iconBuilder, customIconBuilder, iconList, height, borderWidth),
_iconArrangement = IconArrangement.row,
super(
values: values,
styleBuilder: styleBuilder,
customStyleBuilder: customStyleBuilder,
styleList: styleList,
iconList: iconList,
);