How to change the duration of CupertinoPageTransitionsBuilder?


I am using CupertinoPageTransitionsBuilder as default page transition, like this:

theme: ThemeData(
  pageTransitionsTheme: PageTransitionsTheme(builders: {
    TargetPlatform.iOS: CupertinoPageTransitionsBuilder(), CupertinoPageTransitionsBuilder(),

I like the transition, but it is a bit too fast. I want to slow it down, in other words i want to change the transition duration. How can i achieve this without building my own custom transition from scratch?


I achieved it:

class MyRoute extends MaterialPageRoute {
  MyRoute({builder}) : super(builder: builder);

  Duration get transitionDuration => Duration(/*desired duration here*/);

And then, instead of using

Navigator.push(context, MaterialPageRoute(builder: (context) => MyScreen()));

I used

Navigator.push(context, MyRoute(builder: (context) => MyScreen()));

Answered By – Ercan Tomaç

Answer Checked By – Mildred Charles (FlutterFixes Admin)

Leave a Reply

Your email address will not be published.