Adding Screens
Creating new screens
Adding a new screens can be done in a couple of steps
Create a new folder, i call it
new_screenand place it under/lib/screens/.Create a new file
new_screen.dartwithin this folder.
class NewScreen extends StatelessWidget {
. . .
. . .
}Update Routes file
Open the
/lib/routes.dartAdd a new line like below
NB: I called my new route "new_screen"
//import the recent screen you created "NewScreen"
'/new_screen': (context) => NewScreen(),you can refer to your new route by "navigation" using the code below
Navigator.pushReplacementNamed(context, '/new_screen');Last updated
Was this helpful?