flutterflutter-getx

Is there any way to make GetX navigation to use cupertino page route instead of material page route


I want my app to have that iOS smooth slide in/push in page transition, and I was able to achieve that when I use the native Navigation API provided by flutter, the only thing I should do is to pass a CupertinoPageRoute instead of a MaterialPageRoute, but as you all know, the syntax for the native navigation API is a but verbose, and I prefer using GetX navigation in my app since it's easy to read but with GetX I couldn't find a way to force the use of CupertinoPageRoute.

So my question is: Is there any way to achieve the behavior I talked about above using GetX?

What I tried: the traditional way

/// rest of code
   onTap :  () => Navigator.of(context).push(MaterialPageRoute(builder: (_) => NewScreen())),
/// rest of code

for iOS style

/// rest of code
   onTap : () => Navigator.of(context).push(CupertinoPageRoute(builder: (_) => NewScreen())),
/// rest of code

using GetX

/// rest of code
   onTap : () => Get.to(() => NewScreen()),
/// rest of code

The problem here with GetX is that I get the desired behavior but only when on iOS device but not on Android device, and I do get the wanted results using the CupertinoPageRoute but my question again is achieving a transition similar to Cupertino Style on Android but using GetX.


Solution

  • Apparently you can do that using the transition property in the navigation functions, like this:

    Get.to(()=> PageName(), transition: Transitions.fade)

    and there many options to choose from.