slidePage function

Route slidePage(
  1. Widget child, {
  2. AxisDirection axisDirection = AxisDirection.right,
})

Implementation

Route slidePage(Widget child,
    {AxisDirection axisDirection = AxisDirection.right}) {
  return PageRouteBuilder(
    pageBuilder: (context, animation, secondaryAnimation) => child,
    transitionsBuilder: (context, animation, secondaryAnimation, child) {
      final begin = offsetFromDirection(axisDirection);
      const end = Offset.zero;
      const curve = Curves.ease;

      var tween = Tween(begin: begin, end: end).chain(CurveTween(curve: curve));

      return SlideTransition(
        position: animation.drive(tween),
        child: child,
      );
    },
  );
}