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_screen and place it under /lib/screens/ .

  • Create a new file new_screen.dart within this folder.

class NewScreen extends StatelessWidget {
. . .
. . .
}

Update Routes file

  • Open the /lib/routes.dart

  • Add 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');