DrivenSwitcher constructor
const
DrivenSwitcher(
- Widget enabled, {
- Widget? atError,
- Widget? atDisabled,
- Widget? atLoading,
- Widget? atDragged,
- Widget? atPressed,
- Widget? atHovered,
- Widget? atFocused,
- Widget? atIndeterminate,
- Widget? atSelected,
- Map<
WidgetEvent, Widget?> registry = const {}, - Key? key,
- Duration? duration,
- Duration? reverseDuration,
- Curve? switchInCurve,
- Curve? switchOutCurve,
- AnimatedSwitcherTransitionBuilder? transitionBuilder,
- AnimatedSwitcherLayoutBuilder? layoutBuilder,
- bool? maintainKey = true,
Creates a DrivenSwitcher
with the provided child widgets for different
event states and optional animation parameters.
This constructor inherits all parameters from DrivenChild
for defining
child widgets based on events. Additionally, you can specify:
duration
: The duration of the switch animation.reverseDuration
: The duration of the reverse switch animation.switchInCurve
: The curve used for the switch-in animation.switchOutCurve
: The curve used for the switch-out animation.transitionBuilder
: A custom builder function for the switch animation.layoutBuilder
: A custom builder function for the layout of the AnimatedSwitcher.maintainKey
: Whether to maintain a key for the child widget during switching (defaults to true).
Implementation
const DrivenSwitcher(
super.enabled, {
super.atError,
super.atDisabled,
super.atLoading,
super.atDragged,
super.atPressed,
super.atHovered,
super.atFocused,
super.atIndeterminate,
super.atSelected,
super.registry,
super.key,
this.duration,
this.reverseDuration,
this.switchInCurve,
this.switchOutCurve,
this.transitionBuilder,
this.layoutBuilder,
this.maintainKey = true,
}) : super();