2

I have a Flutter MaterialApp.

When I navigate between pages it makes a slide left animation.
I don't want any transition animations between page changes.

void main() {
  runApp(MaterialApp(
    //home: MainScreen(),
    initialRoute: '/',
    routes: {
      '/': (context) => MenuPage(),
      '/page2': (context) => Page2(),
    }
  ));
}

How do I turn off the page transition animations ?

1 Answer 1

8

Use the below code to navigate without animation.

    Navigator.push(context, PageRouteBuilder(pageBuilder: (_, __, ___) => 
       YourScreenName(), 
       transitionDuration: Duration(seconds: 0),
     ),
   );
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.