verticalFlip method

Widget verticalFlip(
  1. double aniValue,
  2. int index,
  3. double page,
  4. Widget child,
)

Implementation

Widget verticalFlip(double aniValue, int index, double page, Widget child) {
  double angle = 0;
  if (page > index) {
    angle = (math.pi * (1 - aniValue)).clamp(0, math.pi / 2);
  } else {
    angle = (math.pi * aniValue).clamp(math.pi / 2, math.pi);
    child = Transform(
      alignment: Alignment.center,
      transform: Matrix4.identity()..rotateX(math.pi),
      child: child,
    );
  }
  return Transform(
    alignment: Alignment.center,
    transform: Matrix4.identity()
      ..setEntry(3, 2, 0.001)
      ..rotateX(angle),
    child: child,
  );
}