Buddy
Search…
Buddy
Introduction
Getting Started
The App
Directory Structure
Adding Screens
Others
License
Powered By
GitBook
Adding Screens
Creating Screen Files
Adding a new screen can be done in a couple of steps
Create a new folder, say
new_screen
and place it under
/lib/views/
.
Create a new file
new_screen.dart
within this folder.
1
class NewScreen extends StatelessWidget {
2
. . .
3
. . .
4
}
Copied!
Update Routes file
Open the
/lib/constants/routes.dart
Add a new line like below
1
static const String newRoute = "new_route_name";
Copied!
Update Router file
Open the file
/lib/config/router.dart
import
newly created Screen into the Router
1
import 'package:appname/views/new_screen/new_screen.dart';
2
3
Route<dynamic> generateRoute(RouteSettings settings) {
4
switch (settings.name) {
5
case AppRoutes.newRoute:
6
return MaterialPageRoute(builder: (_) => NewScreen());
7
}
8
Copied!
The App - Previous
Directory Structure
Next - Others
License
Last modified
1yr ago
Copy link
Contents
Creating Screen Files
Update Routes file
Update Router file