pageRouteBuilder static method

PageRouteBuilder pageRouteBuilder(
  1. Widget child, {
  2. NavigateAnimType animationType = NavigateAnimType.leftToRight,
})

This is our page route Builder with animation

Implementation

static PageRouteBuilder pageRouteBuilder(Widget child, {NavigateAnimType animationType = NavigateAnimType.leftToRight}) {
  return PageRouteBuilder(
    transitionDuration: const Duration(milliseconds: 300),
    pageBuilder: (context, animation, secondaryAnimation) => child,
    transitionsBuilder: (context, animation, secondaryAnimation, child) {
      switch (animationType) {
        case NavigateAnimType.rightToLeft:
          return rightToLeft(context, animation, secondaryAnimation, child);
        case NavigateAnimType.topToBottom:
          return topToBottom(context, animation, secondaryAnimation, child);
        case NavigateAnimType.bottomToTop:
          return bottomToTop(context, animation, secondaryAnimation, child);
        case NavigateAnimType.leftToRight:
        default:
          return leftToRight(context, animation, secondaryAnimation, child);
      }
    },
  );
}