jonataslaw / getx

Open screens/snackbars/dialogs/bottomSheets without context, manage states and inject dependencies easily with Get.
MIT License
10.3k stars 1.61k forks source link

page transition not working in named routing #2241

Open MRezaKarimi opened 2 years ago

MRezaKarimi commented 2 years ago

I set defaultTransition: Transition.cupertino in GetMaterialApp. When I change route using Get.to() it works fine; but when I use Get.toNamed() it not works anymore.

here is my code:

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return GetMaterialApp(
      title: 'My App',
      defaultTransition: Transition.cupertino,
      initialRoute: SplashScreen.route,
      routes: {
        ...
      },
    );
  }
}

Get version: 4.6.1 Flutter version: 2.8

evanmcpheron commented 1 year ago
runApp(GetMaterialApp(    
    initialRoute: '/home',
    defaultTransition: Transition.cupertino,
    getPages: [
      //Simple GetPage
      GetPage(name: '/home', page: () => First()),
      // GetPage with custom transitions and bindings
      GetPage(
        name: '/second',
        page: () => Second(),
        customTransition: SizeTransitions(),
        binding: SampleBind(),
      ),
      // GetPage with default transitions
      GetPage(
        name: '/third',
        transition: Transition.cupertino,
        page: () => Third(),
      ),
    ],
  ));

Forming your routes like this should fix the issue. This is specifically for Get named routes.

faizananwerali commented 9 months ago

I added transitionDuration, along with routes in getPages and it starts working.

        defaultTransition: Transition.circularReveal,
        transitionDuration: const Duration(seconds: 1),
        getPages: [...]
usman092 commented 6 months ago

Provided solution fixed my issue when I removed the transition and transitionDuration from GetPage.