horizontalFlip method

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

Implementation

Widget horizontalFlip(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()..rotateY(math.pi),
      child: child,
    );
  }
  return Transform(
      alignment: Alignment.center,
      transform: Matrix4.identity()
        ..setEntry(3, 2, 0.001)
        ..rotateY(angle),
      child: child);
}