1

I am trying to go to the next screen with Flutter. Using navigator with this

class SlideRightRoute extends PageRouteBuilder {
  final Widget widget;

  SlideRightRoute({this.widget})
      : super(
          pageBuilder: (
            BuildContext context,
            Animation<double> animation,
            Animation<double> secondaryAnimation,
          ) {
            return widget;
          },
          transitionsBuilder: (
            BuildContext context,
            Animation<double> animation,
            Animation<double> secondaryAnimation,
            Widget child,
          ) {
            return new SlideTransition(
              position: new Tween<Offset>(
                begin: const Offset(1.0, 0.0),
                end: Offset.zero,
              ).animate(animation),
              child: child,
            );
          },
        );
}

I can go to the next screen and the next screen slides in from the right. I want previous screen to slide to the left at the same time. How can I add sliding animation to previous screen?

sasha199568
  • 1,143
  • 1
  • 11
  • 33

1 Answers1

0

Not sure you can. But you can achieve this by using PageView if it fits your criteria.

Link to docs: https://docs.flutter.io/flutter/widgets/PageView-class.html

knezzz
  • 683
  • 5
  • 14
  • 2
    You 100% can do this. See https://stackoverflow.com/a/53667835/2662227 – Matt Mar 07 '19 at 18:16
  • Oooooh, yeah nice, didn't think about sending this screen to Transition. Okay my bad, I think this is the answer they were looking for :) – knezzz Mar 07 '19 at 18:42