vertical method

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

Implementation

Widget vertical(double aniValue, int index, double page, Widget child) {
  var alignment = Alignment.centerRight;
  var value = 1 - aniValue;
  if (page >= index) {
    /// _pageController.page > index 向上滑动 划出下一页 下一页可见
    alignment = Alignment.bottomCenter;
    value = 1 - aniValue;
  } else {
    /// _pageController.page < index 向下滑动 划出上一页
    alignment = Alignment.topCenter;
    value = aniValue - 1;
  }
  return Transform(
    transform: Matrix4.identity()
      ..setEntry(3, 2, -0.001)
      ..rotateX(math.pi / 2 * value),
    alignment: alignment,
    child: child,
  );
}