This is the sample code using rootName but here I am not able to use MaterialPageRoute to get the fullScreenDialog property.
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
initialRoute: '/',
routes: {
'/': (context) => MyHomePage(),
'/under-development': (context) => UnderDevelopment(),
'/profile1': (context) => Profile1()
},
title: appName,
debugShowCheckedModeBanner: false,
theme: ThemeData(
primaryColor: primaryColor,
accentColor: secondaryColor,
fontFamily: 'Poppins'),
);
}
}
Navigator
onTap: () {
Navigator.pushNamed(context, '/profile1');
},
You can use something like this inside Material App. I hope it helps.
onGenerateRoute: (RouteSettings settings) {
List<String> pathElements = settings.name.split("/");
if (pathElements[0] != "") return null;
switch (pathElements[1]) {
case "home":
String userID = pathElements[2];
return MaterialPageRoute(
builder: (context) => ReportsPage(
userID: userID,
),fullscreenDialog: true);
}
},
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With