withAnimation method

Widget withAnimation(
  1. GarnishAnimation animation, {
  2. ValueKey? animationKey,
  3. VoidCallback? onComplete,
  4. GarnishAnimationController? controller,
})

Wraps this widget with a GarnishAnimated.

Example:

Text('Hello').withAnimation(GarnishAnimation.fadeSlideUp())

With trigger:

final shake = GarnishAnimation.shake();

Text('Error!').withAnimation(shake)

// Later, trigger it:
shake.trigger();

Implementation

Widget withAnimation(
  GarnishAnimation animation, {
  ValueKey? animationKey,
  VoidCallback? onComplete,
  GarnishAnimationController? controller,
}) {
  return GarnishAnimated(
    animation: animation,
    animationKey: animationKey,
    onComplete: onComplete,
    controller: controller,
    child: this,
  );
}