The Flutter TabBar flutter development tutorial describes how to switch between flutter images widgets using the TabBar.
This flutter development tutorial follows on from the BottomNavigationBar flutter tutorial.
Knowledge of the dart programming language is not required, but the experience of an object orientated programming language is recommended. Such as Java, C++, Kotlin, Swift to name a few.
In this flutter development tutorial we will cover:
- Creating a TabController
- Adding TabBar to Scaffold widget
- Replacing Scaffold body with TabBarView
- Updating TabBar from drawer and popup menu
- Updating BottomNavigationBar from TabController listener
This flutter development tutorial described how to add a TabBar to a flutter application.
To synchronize changes between the TabBar and TabBarView a TabController instance must be created.
Conveniently the Scaffold provides a bottom property which can be used for the TabBar. The Scaffold body will be replaced with the TabBarView.
To support selections from the drawer and popup menu, the TabController index can be modified.
To update the BottomNavigationBar tabs with TabBar changes, the TabController listener is used to modify the BottomNavigationBar’s index.