rubberBand static method

AnimatedBuilder rubberBand(
  1. Animation<double> animation,
  2. Widget child
)

橡皮筋动画

Implementation

static AnimatedBuilder rubberBand(Animation<double> animation, Widget child) {
  return AnimatedBuilder(
    animation: animation,
    builder: (context, child) {
      final scale = animation.value <= 0.5
          ? 1.0 + animation.value
          : 1.5 - animation.value;
      return Transform.scale(scale: scale, child: child);
    },
    child: child,
  );
}