AnimatedToggleSwitch<T extends Object?>.rolling constructor
AnimatedToggleSwitch<T extends Object?>.rolling ({
- Key? key,
- 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.fromWidth(46.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,
- double height = 50.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,
This constructor defines a rolling animation using the foregroundIndicatorIconBuilder of AnimatedToggleSwitch.
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.rolling({
super.key,
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,
this.indicatorSize = const Size.fromWidth(46.0),
this.onChanged,
this.borderWidth = 2.0,
this.style = const ToggleStyle(),
this.styleBuilder,
this.customStyleBuilder,
this.styleList,
this.iconOpacity = 0.5,
this.spacing = 0.0,
this.height = 50.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,
iconAnimationDuration = Duration.zero,
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,
);