DrivenSwitcher constructor

const DrivenSwitcher(
  1. Widget enabled, {
  2. Widget? atError,
  3. Widget? atDisabled,
  4. Widget? atLoading,
  5. Widget? atDragged,
  6. Widget? atPressed,
  7. Widget? atHovered,
  8. Widget? atFocused,
  9. Widget? atIndeterminate,
  10. Widget? atSelected,
  11. Map<WidgetEvent, Widget?> registry = const {},
  12. Key? key,
  13. Duration? duration,
  14. Duration? reverseDuration,
  15. Curve? switchInCurve,
  16. Curve? switchOutCurve,
  17. AnimatedSwitcherTransitionBuilder? transitionBuilder,
  18. AnimatedSwitcherLayoutBuilder? layoutBuilder,
  19. 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();