Animated Switcher
The Animated Switcher widget provides a smooth transition between two child widgets. When the Show First Child
property changes, the widget animates the transition from one child to the other, providing a visually appealing user experience. This is useful for showing different states of a UI element, such as a loading spinner transitioning to content, or toggling between two views.
Properties
Animation Duration
The duration of the animation in milliseconds. This controls how long the transition between the two children takes.
Show First Child
A boolean value that determines which child is currently visible. If true
, the first child is shown; otherwise, the second child is shown.
Default Properties
The Animated Switcher widget supports all Default Properties.
Children of Animated Switcher
firstChild
This is the first child of the animated switcher. When showFirstChild
is true, this widget will be displayed.
secondChild
This is the second child of the animated switcher. When showFirstChild
is false, this widget will be displayed.
Best Practices
Use the
AnimatedSwitcher
to create smooth transitions between two states of a UI element.Keep the animation duration short to avoid a sluggish user experience.
For more complex animations, consider using the
AnimationBuilder
widget.
Last updated