animateWidget method
Animates the specified child widget based
on the animation type and arguments.
child is the widget to be animated.
animationArguments the parameter of type AnimationArguments
that specifies the animation details such as delay, curve, and direction.
Returns the animated version of the child widget.
Example usage:
Animations.fadeAnimation.animateWidget(
MyWidget(),
animationArguments: AnimationArguments(
Animations.fadeAnimation,
delay: 500,
curve: Curves.easeInOut,
),
);
Implementation
Widget animateWidget(
Widget child, {
AnimationArguments? animationArguments,
}) {
if (animationArguments != null) {
switch (this) {
case Animations.fadeAnimation:
return FadeAnimation(
delay: animationArguments.delay,
child: child,
);
case Animations.directionalAnimation:
return DirectionalAnimation(
delay: animationArguments.delay,
direction: animationArguments.direction ??
DirectionalAnimationDirection.top,
curve: animationArguments.curve,
child: child,
);
}
}
return child;
}