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) {
  if (page == index) {
    return child;
  } else if (page > index) {
    return LayoutBuilder(builder: (context, constraints) {
      return Transform.translate(
        offset: Offset(constraints.maxWidth * (1 - aniValue), 0),
        child: child,
      );
    });
  } else {
    return LayoutBuilder(builder: (context, constraints) {
      return ClipRect(
        child: Align(
          widthFactor: aniValue,
          child: Transform.translate(
            offset: Offset(-constraints.maxWidth * (1 - aniValue), 0),
            child: child,
          ),
        ),
      );
    });
  }
}