lightSpeedInLeft static method

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

从左侧加速进入动画

Implementation

static AnimatedBuilder lightSpeedInLeft(
  Animation<double> animation,
  Widget child,
) {
  return AnimatedBuilder(
    animation: animation,
    builder: (context, child) {
      final double translateX = (animation.value - 1.0) * 400;
      final double opacity = animation.value;
      return Transform.translate(
        offset: Offset(translateX, 0),
        child: Opacity(opacity: opacity, child: child),
      );
    },
    child: child,
  );
}