When you need to wrap multiple screen in a single screen and navigate through them, you have to use Tab and Drawer. When user select a tab, this object sends a message to the parent container for switch the displayed page.
Tab and Drawer provides all feature of an application on a single page. So, user can know about the app easily.
In this post, we'll see TabBar and Drawer implementation in Flutter Application. For achieve and maintain state of Application we'll use Redux architecture that we have discuss here.
Here, we have complete project structure.
Let's begin it's implementation with following steps.
1. Update pubspec.ymal dependencies.
2. Now, move on application entry point that is main.dart. Here, we have created store. It'll manage application state like selection of left drawer state. As we have explained all about Store in detail here. If you have query regarding Redux. You should learn about it. Because, we going to use it in this project. As you can see, we have created store.
After that create base and initialize state of application.
3. Create another dart file and name it home_screen.dart. Here, we'll create TabBar and Left Drawer menu. For handle Tabbar, we have created instance of TabController and given length 3 because we need three tab.
For manage Drawer, we have created instance of Drawer and append instance of DrawerHeaderBox that'll contain header of drawer. As you can see complete file below.
4. After that create tab_screen.dart file. It'll show tab screen content after switching. In this file, we just showing a text that display tab title. You can modify it according to your need.
5. After that create some redux dart that manage state of app.
6. Now, Let's create our drawer screen. For it create a directory drawer. Here, We'll put all drawer files.
7. In drawer folder, first of all create drawer_header.dart. Here, we using CircleAvatar, Image and two Text for screen header interface.
8. It's time to create dynamic list of drawer. To achieve it, Create drawer_list.dart. Here, We will display drawer list items.
9. Now create drawer_list_view_model.dart file. Here, we maintain state and keep drawer resource.
10. After that create drawer_middleware.dart file. Here, You can change list item text and add new. In this file, we have write some code redux as discuss above.
11. Create drawer_model.dart and put following model code.
12. Create drawer_reducer.dart. It will change state of drawer on basis of event.
13. Create drawer_selectors.dart. It will maintain state of selected drawer item.
14. Create drawer_state.dart. Here, we'll keep state of drawer.
You can get complete working project from Github. If you any query regarding above project feel free to ask it in comment section below.
Tab and Drawer provides all feature of an application on a single page. So, user can know about the app easily.
In this post, we'll see TabBar and Drawer implementation in Flutter Application. For achieve and maintain state of Application we'll use Redux architecture that we have discuss here.
Here, we have complete project structure.
Let's begin it's implementation with following steps.
1. Update pubspec.ymal dependencies.
2. Now, move on application entry point that is main.dart. Here, we have created store. It'll manage application state like selection of left drawer state. As we have explained all about Store in detail here. If you have query regarding Redux. You should learn about it. Because, we going to use it in this project. As you can see, we have created store.
After that create base and initialize state of application.
3. Create another dart file and name it home_screen.dart. Here, we'll create TabBar and Left Drawer menu. For handle Tabbar, we have created instance of TabController and given length 3 because we need three tab.
For manage Drawer, we have created instance of Drawer and append instance of DrawerHeaderBox that'll contain header of drawer. As you can see complete file below.
4. After that create tab_screen.dart file. It'll show tab screen content after switching. In this file, we just showing a text that display tab title. You can modify it according to your need.
6. Now, Let's create our drawer screen. For it create a directory drawer. Here, We'll put all drawer files.
7. In drawer folder, first of all create drawer_header.dart. Here, we using CircleAvatar, Image and two Text for screen header interface.
8. It's time to create dynamic list of drawer. To achieve it, Create drawer_list.dart. Here, We will display drawer list items.
9. Now create drawer_list_view_model.dart file. Here, we maintain state and keep drawer resource.
10. After that create drawer_middleware.dart file. Here, You can change list item text and add new. In this file, we have write some code redux as discuss above.
12. Create drawer_reducer.dart. It will change state of drawer on basis of event.
14. Create drawer_state.dart. Here, we'll keep state of drawer.
At the end, merge all file and run it. You'll see
You can get complete working project from Github. If you any query regarding above project feel free to ask it in comment section below.