Want to animate transition to named route in flutter You need to use onGenerateRoute in your MaterialApp widget.
1 2 3 4 5 6 7 8 9 10 11 12 | onGenerateRoute: (settings) { if (settings.name == "/someRoute") { return PageRouteBuilder( pageBuilder: (_, __, ___) => SomePage(), transitionsBuilder: (_, anim, __, child) { return FadeTransition(opacity: anim, child: child); }, ); } // unknown route return MaterialPageRoute(builder: (context) => UnknownPage()); }, |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.