buildPageRoute method

  1. @override
PageRoute buildPageRoute(
  1. Widget child,
  2. Duration duration,
  3. Curve curve
)
override

Implementation

@override
PageRoute buildPageRoute(Widget child, Duration duration, Curve curve) {
  return PageRouteBuilder(
    pageBuilder: (_, __, ___) => child,
    transitionDuration: duration,
    transitionsBuilder: (_, animation, __, child) {
      double x = animation.value * 200.0;
      double y = animation.value * 100.0;
      return Transform.translate(
        offset: Offset(x, y),
        child: child,
      );
    },
  );
}