flash static method

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

闪烁动画

Implementation

static AnimatedBuilder flash(Animation<double> animation, Widget child) {
  return AnimatedBuilder(
    animation: animation,
    builder: (context, child) {
      final opacity =
          animation.value > 0.5 ? 1.0 - animation.value : animation.value;
      return Opacity(opacity: opacity, child: child);
    },
    child: child,
  );
}