flipInX static method

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

沿 X 轴翻入动画

Implementation

static AnimatedBuilder flipInX(
  Animation<double> animation,
  Widget child,
) {
  return AnimatedBuilder(
    animation: animation,
    builder: (context, child) {
      final angle = math.pi * (1.0 - animation.value);
      return Transform(
        alignment: Alignment.center,
        transform: Matrix4.rotationX(angle)..scale(animation.value),
        child: Opacity(opacity: animation.value, child: child),
      );
    },
    child: child,
  );
}