The Final App
Learn how to configure and compile Flutter apps for cross-platform use.
We'll cover the following...
At the beginning of the course, we chose to create a tree forum app as our learning project where users can post and learn about tree planting events in their region. The project was divided into segments throughout this course, and by progressing through each segment, we developed the app. Now, the final action that remains is to combine the different sections and create a continuous cross-platform application.
To achieve this, we need to do the following:
Routing
We have to use the GetX package to list all the pages we have created in our app to ease the navigation process across the app. The route is listed in the main.dart
file as follows:
getPages: [GetPage(name: '/', page: () => const SplashScreen()),GetPage(name: '/login', page: () => const LoginInPage()),GetPage(name: '/signup', page: () => const SignUpPage()),GetPage(name: '/Profile', page: () => UserProfileScreen()),GetPage(name: '/Welcome', page: () => WelcomePage()),GetPage(name: '/Addpost', page: () => const AddPost()),GetPage(name: '/Form', page: () => const ProfileTab()),GetPage(name: '/Homepage',page: () => const HomePage(selectedIndex: 0,)),GetPage(name: '/Response',page: () => const ResponsiveLayout(mobileScreenLayout: mobilescreenlayout(),webScreenLayout: weblcreenlayout())),],initialRoute: '/',);
Here we configure the routing of the app using the GetPage
class of the GetX library on lines 3–20. Each route is associated with a specific page or screen of the app. As an example, the /login
route maps the LoginInPage
page.