withAnimation method

SnackBar withAnimation(
  1. Animation<double> newAnimation, {
  2. Key? fallbackKey,
})

Creates a copy of this snack bar but with the animation replaced with the given animation.

If the original snack bar lacks a key, the newly created snack bar will use the given fallback key.

Implementation

SnackBar withAnimation(Animation<double> newAnimation, { Key? fallbackKey }) {
  return SnackBar(
    key: key ?? fallbackKey,
    content: content,
    backgroundColor: backgroundColor,
    elevation: elevation,
    margin: margin,
    padding: padding,
    width: width,
    shape: shape,
    hitTestBehavior: hitTestBehavior,
    behavior: behavior,
    action: action,
    actionOverflowThreshold: actionOverflowThreshold,
    showCloseIcon: showCloseIcon,
    closeIconColor: closeIconColor,
    duration: duration,
    animation: newAnimation,
    onVisible: onVisible,
    dismissDirection: dismissDirection,
    clipBehavior: clipBehavior,
  );
}