CustomAnimatedToggleSwitch<T extends Object?> constructor
const
CustomAnimatedToggleSwitch<T extends Object?> ({
- Key? key,
- required T current,
- required List<
T> values, - required CustomIconBuilder<
T> iconBuilder, - Duration animationDuration = const Duration(milliseconds: 500),
- Curve animationCurve = Curves.easeInOutCirc,
- Size indicatorSize = const Size(48.0, double.infinity),
- ChangeCallback<
T> ? onChanged, - double spacing = 0.0,
- CustomSeparatorBuilder<
T> ? separatorBuilder, - TapCallback<
T> ? onTap, - FittingMode fittingMode = FittingMode.preventHorizontalOverlapping,
- CustomWrapperBuilder<
T> ? wrapperBuilder, - CustomIndicatorBuilder<
T> ? foregroundIndicatorBuilder, - CustomIndicatorBuilder<
T> ? backgroundIndicatorBuilder, - IndicatorAppearingBuilder indicatorAppearingBuilder = _defaultIndicatorAppearingBuilder,
- double height = 50.0,
- IconArrangement iconArrangement = IconArrangement.row,
- bool iconsTappable = true,
- EdgeInsetsGeometry padding = EdgeInsets.zero,
- double minTouchTargetSize = 48.0,
- Duration dragStartDuration = const Duration(milliseconds: 200),
- Curve dragStartCurve = Curves.easeInOutCirc,
- TextDirection? textDirection,
- ToggleCursors cursors = const ToggleCursors(),
- bool? loading,
- Duration? loadingAnimationDuration,
- Curve? loadingAnimationCurve,
- Duration indicatorAppearingDuration = _defaultIndicatorAppearingAnimationDuration,
- Curve indicatorAppearingCurve = _defaultIndicatorAppearingAnimationCurve,
- bool allowUnlistedValues = false,
- bool active = true,
- PositionListener<
T> ? positionListener,
Implementation
const CustomAnimatedToggleSwitch({
Key? key,
required this.current,
required this.values,
required this.iconBuilder,
this.animationDuration = const Duration(milliseconds: 500),
this.animationCurve = Curves.easeInOutCirc,
this.indicatorSize = const Size(48.0, double.infinity),
this.onChanged,
this.spacing = 0.0,
this.separatorBuilder,
this.onTap,
this.fittingMode = FittingMode.preventHorizontalOverlapping,
this.wrapperBuilder,
this.foregroundIndicatorBuilder,
this.backgroundIndicatorBuilder,
this.indicatorAppearingBuilder = _defaultIndicatorAppearingBuilder,
this.height = 50.0,
this.iconArrangement = IconArrangement.row,
this.iconsTappable = true,
this.padding = EdgeInsets.zero,
this.minTouchTargetSize = 48.0,
this.dragStartDuration = const Duration(milliseconds: 200),
this.dragStartCurve = Curves.easeInOutCirc,
this.textDirection,
this.cursors = const ToggleCursors(),
this.loading,
this.loadingAnimationDuration,
this.loadingAnimationCurve,
this.indicatorAppearingDuration =
_defaultIndicatorAppearingAnimationDuration,
this.indicatorAppearingCurve = _defaultIndicatorAppearingAnimationCurve,
this.allowUnlistedValues = false,
this.active = true,
this.positionListener,
}) : assert(foregroundIndicatorBuilder != null ||
backgroundIndicatorBuilder != null),
assert(separatorBuilder == null ||
(spacing > 0 && iconArrangement == IconArrangement.row)),
super(key: key);