horizontal method

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

Implementation

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