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) {
  double gauss = math.sin(math.pi * aniValue.abs());
  if (page == index) {
    current = index;
    return child;
  } else if (page > index) {
    if (current == index) {
      return child;
    }
    return LayoutBuilder(builder: (context, constraints) {
      return Transform.translate(
        offset: Offset(-constraints.maxWidth / 4 * gauss, 0),
        child: child,
      );
    });
  } else {
    if (current == index) {
      return child;
    }
    return LayoutBuilder(builder: (context, constraints) {
      return Transform.translate(
        offset: Offset(constraints.maxWidth / 4 * gauss, 0),
        child: child,
      );
    });
  }
}