

Download this source code for 5 USD
Multiple navigators with bottom navigation bar.

Multiple Navigators with BottomNavigationBar
This is the source code for my article:
- Flutter Case Study: Multiple Navigators with BottomNavigationBar
In this example each tab has its own navigation stack. This is so that we don’t lose the navigation history when switching tabs.
This is a very common use case for a lot of apps.
How is it built?
- Create an app with a Scaffold and a BottomNavigationBar .
- In the Scaffold body, create a Stack with one child for each tab.
- Each child is an Offstage widget with a child Navigator .
- Don’t forget to handle Android back navigation with WillPopScope .
Read the full story on my article:
- Brian Egan : for suggesting to use Stack + Offstage & Navigator widgets.
License: MIT

Cactus – An application developed for the Android operating system, built using Flutter

Understanding some flutter/dart concepts
Related posts, challenge 3 navigation bar management with flutter, an example of the material 3 navigation bar, custom shaped bottom navigation bar in flutter.

Flutter: BottomAppBar Navigation with FAB

Andrea Bizzotto
Sep 13, 2018 8 min read
Today we'll see how to add a FloatingActionButton (FAB) with options to a BottomAppBar in Flutter. And we'll build this UI:
Our specific goal here is to have a custom BottomAppBar that behaves in the same way as BottomNavigationBar . That is, there are multiple tabs with exactly one selected tab at any given time.
You may wonder, why not using BottomNavigationBar directly?
While it is technically possible to "dock" a FloatingActionButton to a BottomNavigationBar , this does not work very well in practice. More on this below.
For now, let's see how we can achieve the desired look and feel with BottomAppBar .

Build the future of Flutter, faster. With Embrace’s monitoring SDK, you get the critical insight you need to create amazing Flutter apps for your mobile users. Solve crashes, track performance flows, and get a full play-by-play of every users’ full experience. Get started free.
Adding a centered FAB
After creating a new Flutter project, we get the default sample app. This already includes a FloatingActionButton for incrementing a counter.
We can add a BottomAppBar to our Scaffold.bottomNavigationBar like so:
Note how we set Scaffold.floatingActionButtonLocation to FloatingActionButtonLocation.centerDocked to "dock" our FAB to the middle of our BottomAppBar .
Also we set notchedShape: CircularNotchedRectangle() to add a nice notched shape in the BottomAppBar below the FAB.
If we run the app at this stage, this is what we get:
Adding tabs with Navigation
In addition to our FAB, we want to add tabs so that we can view different pages in our app.
To do this, we can create a custom FABBottomAppBar to take care of the following:
- show either 2 or 4 tabs (our design is symmetrical).
- highlight and keep track of the currently selected tab.
- fire a callback each time a tab is selected, so that the parent can update the current page.
So how would a minimal API look like for our FABBottomAppBar ? Let's see:
First, we define a FABBottomAppBarItem class to contain an IconData and a String . This represents a single tab item.
Then, we create a FABBottomAppBar widget. This needs to specify a list of items and a callback ( onTabSelected ).
FABBottomAppBar itself is a StatefulWidget , since it needs to keep track of the selected tab and update its appearance accordingly.
In the FABBottomAppBarState class, we define a _selectedIndex , which is updated when we call _updateIndex .
Next, we need to define the build method, where we add all the items:
A few notes:
- Lines 3 to 9 : here we use a list generator to create the tab items, passing in the correct item, index and width.
- Lines 11 to 17 : we create a BottomAppBar containing a Row with the items we have defined. We use MainAxisSize.max and MainAxisAlignment.spaceAround to ensure that the full width is used and the items are equally spaced.
Then, we implement the _buildTabItem method. Here it is:
On line 6 we check if the selected index matches the current tab index, and we choose the active/inactive color accordingly.
On lines 13 to 26 we define an InkWell wrapped inside a Material widget. This gives us an onTap gesture recognizer and provides a material splash effect when the widget is tapped.
The child of our InkWell is a Column which contains an Icon and Text , both configured with the data from the input FABBottomAppBarItem .
The whole result is wrapped inside an Expanded widget. This guarantees that each item has the same width inside the parent Row .
We can test the FABBottomAppBar we created by using it as the bottomNavigationBar of our Scaffold , and providing four items:
Here is the result:
We can now switch tabs, and get a callback each time we do so.
Sweating the details
Encouraging progress so far. But there are a few things that we could improve to make our FABBottomAppBar more "production-ready".
In the example code above, we have hard-coded the following things:
- BottomAppBar : height , backgroundColor and notchedShape
- Active / inactive tab color
In addition, the middle tab icons feel a bit too close to the FAB itself. It would be good to add some spacing in the middle.
Even better, why not add a small optional text caption just below the FAB, baseline-aligned with the text of the tabs?
Let's address all these concerns in one go. Here is the final code for our FABBottomAppBar :
Note how now we can specify a centerItemText , which will be positioned just below the FAB. If this is empty or null , we render an empty Text .
Here is the final result:
What about BottomNavigationBar?
I have tried docking the FAB inside a BottomNavigationBar , but I have found some limitations:
- There is no way of adding a placeholder or empty text under the FAB, other than creating a BottomNavigationBarItem . This is not desirable as BottomNavigationBarItem is a tab in its own right and can be tapped.
- BottomNavigationBar doesn't support notchedShape .
Using BottomAppBar requires more code but is more flexible as it uses a Row under the hood, and this can be configured as we please.
By the way, if you want to learn more about BottomNavigationBar and how to use it to enable multiple independent Navigators, make sure to read my previous article:
- Flutter Case Study: Multiple Navigators with BottomNavigationBar
Full source code
I open sourced my full example here on GitHub . 🙏
Feel free to reuse it in your projects. 😎
Revealing options when the FAB is tapped
This is covered on the next article:
- Flutter: Adding Animated Overlays to Your App
Happy coding!
Never miss my articles & tutorials
Join 18K+ Flutter developers who get 2+ high-quality articles every month. Published on Fridays.
No spam, ever. Unsubscribe at any time.
Invest in yourself with my high-quality Flutter courses.

Flutter Foundations Course
Learn about State Management, App Architecture, Navigation, Testing, and much more by building a Flutter eCommerce app on iOS, Android, and web.

Flutter & Firebase Masterclass
Learn about Firebase Auth, Cloud Firestore, Cloud Functions, Stripe payments, and much more by building a full-stack eCommerce app with Flutter & Firebase.

The Complete Dart Developer Guide
Learn Dart Programming in depth. Includes: basic to advanced topics, exercises, and projects. Fully updated to Dart 2.15.

Flutter Animations Masterclass
Master Flutter animations and build a completely custom habit tracking application.
Grow as a Flutter Developer
- BottomNavigationBar class
A material widget that's displayed at the bottom of an app for selecting among a small number of views, typically between three and five.
There is an updated version of this component, NavigationBar , that's preferred for new applications and applications that are configured for Material 3 (see ThemeData.useMaterial3 ).
The bottom navigation bar consists of multiple items in the form of text labels, icons, or both, laid out on top of a piece of material. It provides quick navigation between the top-level views of an app. For larger screens, side navigation may be a better fit.
A bottom navigation bar is usually used in conjunction with a Scaffold , where it is provided as the Scaffold.bottomNavigationBar argument.
The bottom navigation bar's type changes how its items are displayed. If not specified, then it's automatically set to BottomNavigationBarType.fixed when there are less than four items, and BottomNavigationBarType.shifting otherwise.
The length of items must be at least two and each item's icon and label must not be null.
- BottomNavigationBarType.fixed , the default when there are less than four items . The selected item is rendered with the selectedItemColor if it's non-null, otherwise the theme's ColorScheme.primary color is used for Brightness.light themes and ColorScheme.secondary for Brightness.dark themes. If backgroundColor is null, The navigation bar's background color defaults to the Material background color, ThemeData.canvasColor (essentially opaque white).
- BottomNavigationBarType.shifting , the default when there are four or more items . If selectedItemColor is null, all items are rendered in white. The navigation bar's background color is the same as the BottomNavigationBarItem.backgroundColor of the selected item. In this case it's assumed that each item will have a different background color and that background color will contrast well with white.
Updating to NavigationBar
The NavigationBar widget's visuals are a little bit different, see the Material 3 spec at m3.material.io/components/navigation-bar/overview for more details.
The NavigationBar widget's API is also slightly different. To update from BottomNavigationBar to NavigationBar , you will need to make the following changes.
Instead of using BottomNavigationBar.items , which takes a list of BottomNavigationBarItem s, use NavigationBar.destinations , which takes a list of widgets. Usually, you use a list of NavigationDestination widgets. Just like BottomNavigationBarItem s, NavigationDestination s have a label and icon field.
Instead of using BottomNavigationBar.onTap , use NavigationBar.onDestinationSelected , which is also a callback that is called when the user taps on a navigation bar item.
Instead of using BottomNavigationBar.currentIndex , use NavigationBar.selectedIndex , which is also an integer that represents the index of the selected destination.
You may also need to make changes to the styling of the NavigationBar , see the properties in the NavigationBar constructor for more details.
Using BottomNavigationBar
To create a local project with this code sample, run: flutter create --sample=material.BottomNavigationBar.1 mysample
To create a local project with this code sample, run: flutter create --sample=material.BottomNavigationBar.2 mysample
To create a local project with this code sample, run: flutter create --sample=material.BottomNavigationBar.3 mysample
To create a local project with this code sample, run: flutter create --sample=material.BottomNavigationBar.4 mysample
- BottomNavigationBarItem
- material.io/design/components/bottom-navigation.html
- NavigationBar , this widget's replacement in Material Design 3.
- DiagnosticableTree
- StatefulWidget
- BottomNavigationBar
Constructors
Material library.

Welcome to John Maeda's Blog: maeda.pm. Sharing a passion for product and data, grounded in technology / business / design curiosities with a dash of leadership reflections.
- 🆕 Resilience Books List
- 🆕 The Useful MBA
- 📘 How To Speak Machine
- 📓 Resilience Tech Report
- 🟦 Personal Site
- Creative Leadership (2009-15)
- Traditional vs Creative Leadership (2009)
- Start-ups vs End-ups (2013)
- My Four Rules (1999)
- Managing Through Change (2009-2020)
- 📬 Newsletter
- Toggle the search field
Flutter navigation
Persistent bottom bar https://medium.com/coding-with-flutter/flutter-case-study-multiple-navigators-with-bottomnavigationbar-90eb6caa6dbf
Navigation rail via Material https://material.io/components/navigation-rail
Side navigation tail https://stackoverflow.com/questions/62036593/flutter-side-navigation-bar-widget
Related Posts

China and Emergence
Flutter maps.

Russell / Emotions

Ussing-Up: From I’s to Us’s
Search code, repositories, users, issues, pull requests...
Provide feedback.
We read every piece of feedback, and take your input very seriously.
Saved searches
Use saved searches to filter your results more quickly.
To see all available qualifiers, see our documentation .
- Notifications
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement . We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[go_router] Support multiple navigation stacks #99126
chunhtai commented Feb 25, 2022
- 👍 265 reactions
- ❤️ 26 reactions
mark8044 commented Feb 25, 2022
- 👍 42 reactions
Sorry, something went wrong.
JePoste commented Feb 25, 2022
- 👍 25 reactions
- 👍 23 reactions
Tananga commented Feb 26, 2022
- 👍 27 reactions
fullflash commented Feb 27, 2022
Mark8044 commented feb 27, 2022 • edited.
OppositeDragon commented Mar 3, 2022
rahulrmishra commented Apr 7, 2022 • edited
- 👍 18 reactions
- ❤️ 3 reactions
HarshilPatel18 commented Apr 8, 2022
- 👍 12 reactions
- ❤️ 4 reactions
czaku commented Apr 11, 2022
The-Redhat commented Apr 12, 2022
mono0926 commented Apr 13, 2022
- 🎉 29 reactions
mark8044 commented Apr 18, 2022
- 👍 10 reactions
daanporon commented Jun 8, 2022
- 👍 5 reactions
jhuckabee commented Jun 8, 2022

johnpryan commented Jul 26, 2022
- 🎉 5 reactions
dk5761 commented Jul 26, 2022
- 👍 1 reaction
rhinck commented Jul 27, 2022
Johnpryan commented jul 27, 2022.
- 👍 4 reactions
iEricKoh commented Jul 28, 2022 • edited
- 👀 1 reaction
IlyaMax commented Jul 30, 2022 • edited
ElteHupkes commented Sep 5, 2022
Johnpryan commented sep 6, 2022.
michaelsoliman1 commented Sep 6, 2022
subzero911 commented Sep 6, 2022
- ❤️ 2 reactions
rlee1990 commented Sep 7, 2022
Eltehupkes commented sep 7, 2022.
- 👎 1 reaction
- ❤️ 1 reaction
chunhtai commented Sep 7, 2022
- 👍 3 reactions
mark8044 commented Sep 17, 2022
github-actions bot commented Oct 1, 2022
Successfully merging a pull request may close this issue.
Flutter Bottom Navigation Bar with Multiple Navigators
Flutter bottomnavigationbar with multiple navigators.
This is the source code for my article:
- Flutter Bottom Navigation Bar with Multiple Navigators: A Case Study
In this example each tab has its own navigation stack. This is so that we don’t lose the navigation history when switching tabs.
This is a very common use case for a lot of apps.
How is it built?
- Create an app with a Scaffold and a BottomNavigationBar .
- In the Scaffold body, create a Stack with one child for each tab.
- Each child is an Offstage widget with a child Navigator .
- Don’t forget to handle Android back navigation with WillPopScope .
Read the full story on my article:
- Brian Egan : for suggesting to use Stack + Offstage & Navigator widgets.
License: MIT
View Github
A simple todo llist app using ChatGPT to generage tasks
Image editor app built with flutter, you might also like..., a flutter bottom navigation bar that present navigation in modern applications, persistent bottom navigation bar for flutter, a flutter app which displays bottom navigation, subscribe to flutter awesome.
Get the latest posts delivered right to your inbox

- Product Management
- Solve User-Reported Issues
- Find Issues Faster
- Optimize Conversion and Adoption
- Start Monitoring for Free
How to build a bottom navigation bar in Flutter

Mobile applications often have various categories of content to offer. The Google Play Store app, for example, presents its content in categories such as games, apps, movies, and books. In Flutter apps, the BottomNavigationBar widget enables users to see any one category as the app starts and quickly look at the others with just the tap of a finger.

In this tutorial, we’ll tell you everything you need to know about BottomNavigationBar in Flutter. We’ll demonstrate how it works, walk through some use cases, and show you how to customize the BottomNavigationBar widget in your Flutter app.
Here’s what we’ll cover:
What is BottomNavigationBar in Flutter?
Customizing the bottomnavigationbar, how to preserve the state of pages, how to include tabbar with bottomnavigationbar, hiding bottomnavigationbar on scroll.
BottomNavigationBar is a widget that displays a row of small widgets at the bottom of a Flutter app. Usually, it’s used to show around three to five items. Each item must have a label and an icon. BottomNavigationBar allows you to select one item at a time and quickly navigate to a given page.
Now let’s walk through the process of creating a simple BottomNavigationBar step by step. The finished product will look as follows:
Showing BottomNavigationBar
The BottomNavigationBar widget is given to the bottomNavigationBar property of Scaffold :
BottomNavigationBar has a required property called items . items accept a widget of a type BottomNavigationBarItem . BottomNavigationBarItem is simply used to show the actual item inside BottomNavigationBar.
The above code just displays the BottomNavigationBar with the first item selected as the default. It does not change the selection yet as we click on the other items:
Showing a selection of items
To show the selection of other items, we’ll use two properties: onTap and currentIndex .
The _selectedIndex variable holds the value of the currently selected item. _selectedIndex is given to the currentIndex property.
The _onItemTapped() callback is assigned to onTap of BottomNavigationBar, which returns the index when the item is tapped. Simply assigning a currently selected item index to _selectedIndex and doing setState will show the item as selected in BottomNavigationBar.
Displaying the page of the selected item
As of now, we don’t have any page to show based on the selected item. So let’s go ahead and great it:
_pages hold a list of widgets. For simplicity, we’re just showing a big icon of the item itself.
Showing one page in the center of the screen from _pages based on the _selectedIndex of the item will do the rest of the magic.
Now we have BottomNavigationBar up and running:
The illustration below shows how the code translates into the design:

BottomNavigationBar has a lot of options to customize it per your need. Let’s zoom in on some of the properties you can customize.
Background color
You may want to change the background color of the BottomNavigationBar to match your brand. You do that simply by using the backgroundColor property.

Over 200k developers use LogRocket to create better digital experiences

By default, the BottomNavigationBar is set to elevate 8 points from the surface so that it appears on top of pages. You can set this property to any value:

You can shrink or magnify the size of all the icons at once using iconSize property:

Mouse cursor
When running on the web, you can customize the mouse cursor when it hovers over an item on the BottomNavigationBar:
Selected item
You can make the selected item appear different from an unselected one using the several selected properties of BottomNavigationBar:
Unselected items
You may also want to change the look and feels of unselected items. BottomNavigationBar has a few unselected properties that you can use:
Removing labels
If you want to get rid of the labels entirely, you can use showSelectedLabels and showUnselectedLabels :

Highlighting the selected item
You can emphasize the selected item by setting the BottomNavigationBar type to BottomNavigationBarType.shifting :
Although the basic version of BottomNavigationBar is working well, we have one problem: whatever action — e.g., searching, filtering, entering text, scrolling through a list, filling out a contact form, etc. — is being performed on the page will be lost upon selecting another item from the BottomNavigationBar:
In the demo above, we’re trying to find a contact. When we switch to the camera section before we finish our search and then return to the chat section, the previously entered text is completely gone.
Fear not — the solution is pretty simple. Simply replace the existing widget with IndexedStack . The IndexedStack widget holds a stack of widgets but shows only one at a time. Since all the widgets stay in the stack, the state is preserved.
The index property is used to show one page from the _pages , which is given to the children property.
Sometimes a single page is not enough to cover a wide range of subcategories within a parent category inside BottomNavigationBar. For example, the Google Play Store app has subcategories labeled For you, Top charts, Kids, etc. A scenario like this calls for the Flutter TabBar widget .
For demonstration purposes, let’s try to add TabBar for incoming, outgoing, and missed calls inside the calls section, as shown below:

The overall structure of BottomNavigationBar remains the same. You may need to create a separate class for the page in which you want to include a TabBar. For that purpose, the CallsPage is created and added to the list of pages.
The CallsPage looks like this:
Here’s the output:
When building a Flutter app, you always want to utilize the screen space as efficiently as possible. When a user is scrolling through a long list of items on one of the pages in your app, you can hide the BottomNavigationBar smoothly. This behavior improves the user experience because you’re showing only content that is required at that moment.
As of now, the BottomNavigationBar stays as it is while scrolling through the list of outgoing calls:
Let’s walk through the process of hiding the BottomNavigationBar step by step.
First, wrap your list view inside the NotificationListener widget. NotificationListener listens to the scroll notification happening on the ListView.
Next, implement the _handleScrollNotification method to determine the scroll direction. Notify the page that hosts the BottomNavigationBar to hide it when the user scrolls down.
Wrap the BottomNavigationBar inside the SizeTransition widget. SizeTransition animates the size of BottomNavigationBar.
Start hiding animation on receiving the callback from the page that has the ListView .
Here is the result:
That’s it! The full code for this Flutter BottomNavigationBar example can be found on GitHub .
In this tutorial, we showed how to integrate BottomNavigationBar and customize it. We also learned various use cases with examples that you’ll likely encounter while developing a full-fledged Flutter app. I hope the practical examples we examined in this article helped you understand these important concepts.
Get set up with LogRocket's modern error tracking in minutes:
- Visit https://logrocket.com/signup/ to get an app ID
Install LogRocket via npm or script tag. LogRocket.init() must be called client-side, not server-side
Share this:
- Click to share on Twitter (Opens in new window)
- Click to share on Reddit (Opens in new window)
- Click to share on LinkedIn (Opens in new window)
- Click to share on Facebook (Opens in new window)
Recent posts:

Astro adoption guide: Overview, examples, and alternatives
Astro brings simplicity, speed, and a stellar DX. Let’s explore what makes Astro such a compelling framework for your next project.

Using Alma to create generative graphics
We introduce Alma, a new generative graphic platform, and show how to use its interactive playground to create generative graphics.

Bun adoption guide: Overview, examples, and alternatives
What makes Bun such a great choice for developing fast, performant, error-free frontend apps? Let’s explore when and why you should use Bun.

Exploring Rust compiler options: GCC vs. LLVM
We explore the evolving landscape of Rust compilation, focusing on two native compiler projects: LLVM and GCC.

6 Replies to "How to build a bottom navigation bar in Flutter"
Thank You! You helped me understand nested Scaffold with BottomNavigationBar, also hiding bar is very hendy.
After a lot of research and a lot of time wasted, this was the solution to my problem. Thank you very much
Thank you for such an in depth and concise explanation. I was looking at something exactly like where the app should have a bottom navigation bar always present and some pages will have a secondary navigation (tab bar). You provided everything I needed.
Awesome. You saved me a lot of time for my app. I wasn’t aware you could ‘nest’ these navigation widgets. But it makes sense. Thank you.
Super! Thank you very much!
Leave a Reply Cancel reply
Flutter: BottomAppBar Navigation with FAB
Today we’ll see how to add a FloatingActionButton (FAB) with options to a BottomAppBar in Flutter. And we’ll build this UI:
Our specific goal here is to have a custom BottomAppBar that behaves in the same way as BottomNavigationBar . That is, there are multiple tabs with exactly one selected tab at any given time.
You may wonder, why not using BottomNavigationBar directly?
While it is technically possible to “dock” a FloatingActionButton to a BottomNavigationBar , this does not work very well in practice. More on this below.
For now, let’s see how we can achieve the desired look and feel with BottomAppBar .
Adding a centered FAB
After creating a new Flutter project, we get the default sample app. This already includes a FloatingActionButton for incrementing a counter.
We can add a BottomAppBar to our Scaffold.bottomNavigationBar like so:
Note how we set Scaffold.floatingActionButtonLocation to FloatingActionButtonLocation.centerDocked to “dock” our FAB to the middle of our BottomAppBar .
Also we set notchedShape: CircularNotchedRectangle() to add a nice notched shape in the BottomAppBar below the FAB.
If we run the app at this stage, this is what we get:
Adding tabs with Navigation
In addition to our FAB, we want to add tabs so that we can view different pages in our app.
To do this, we can create a custom FABBottomAppBar to take care of the following:
- show either 2 or 4 tabs (our design is symmetrical).
- highlight and keep track of the currently selected tab.
- fire a callback each time a tab is selected, so that the parent can update the current page.
So how would a minimal API look like for our FABBottomAppBar ? Let’s see:
First, we define a FABBottomAppBarItem class to contain an IconData and a String . This represents a single tab item.
Then, we create a FABBottomAppBar widget. This needs to specify a list of items and a callback ( onTabSelected ).
FABBottomAppBar itself is a StatefulWidget , since it needs to keep track of the selected tab and update its appearance accordingly.
In the FABBottomAppBarState class, we define a _selectedIndex , which is updated when we call _updateIndex .
Next, we need to define the build method, where we add all the items:
A few notes:
- Lines 3 to 9 : here we use a list generator to create the tab items, passing in the correct item, index and width.
- Lines 11 to 17 : we create a BottomAppBar containing a Row with the items we have defined. We use MainAxisSize.max and MainAxisAlignment.spaceAround to ensure that the full width is used and the items are equally spaced.
Then, we implement the _buildTabItem method. Here it is:
On line 6 we check if the selected index matches the current tab index, and we choose the active/inactive color accordingly.
On lines 13 to 26 we define an InkWell wrapped inside a Material widget. This gives us an onTap gesture recognizer and provides a material splash effect when the widget is tapped.
The child of our InkWell is a Column which contains an Icon and Text , both configured with the data from the input FABBottomAppBarItem .
The whole result is wrapped inside an Expanded widget. This guarantees that each item has the same width inside the parent Row .
We can test the FABBottomAppBar we created by using it as the bottomNavigationBar of our Scaffold , and providing four items:
Here is the result:
We can now switch tabs, and get a callback each time we do so.
Sweating the details
Encouraging progress so far. But there are a few things that we could improve to make our FABBottomAppBar more “production-ready”.
In the example code above, we have hard-coded the following things:
- BottomAppBar : height , backgroundColor and notchedShape
- Active / inactive tab color
In addition, the middle tab icons feel a bit too close to the FAB itself. It would be good to add some spacing in the middle.
Even better, why not add a small optional text caption just below the FAB, baseline-aligned with the text of the tabs?
Let’s address all these concerns in one go. Here is the final code for our FABBottomAppBar :
Note how now we can specify a centerItemText , which will be positioned just below the FAB. If this is empty or null , we render an empty Text .
Here is the final result:
What about BottomNavigationBar?
I have tried docking the FAB inside a BottomNavigationBar , but I have found some limitations:
- There is no way of adding a placeholder or empty text under the FAB, other than creating a BottomNavigationBarItem . This is not desirable as BottomNavigationBarItem is a tab in its own right and can be tapped.
- BottomNavigationBar doesn’t support notchedShape .
Using BottomAppBar requires more code but is more flexible as it uses a Row under the hood, and this can be configured as we please.
By the way, if you want to learn more about BottomNavigationBar and how to use it to enable multiple independent Navigators, make sure to read my previous article:
- Flutter Case Study: Multiple Navigators with BottomNavigationBar
Full source code
I open sourced my full example here on GitHub . 🙏
Feel free to reuse it in your projects. 😎
Revealing options when the FAB is tapped
I’ll cover this on my next article - hold tight! 😉
Happy coding!
LEARN FLUTTER TODAY
Sign up for updates and get my free Flutter Layout Cheat Sheet.
Success! Now check your email to confirm your subscription.
There was an error submitting your subscription. Please try again.
- ← Previous Post
- Next Post →

IMAGES
VIDEO
COMMENTS
Flutter Bottom Navigation Bar with Multiple Navigators: A Case Study #flutter #dart #navigation Andrea Bizzotto Updated Dec 5, 2020 12 min read Source code on GitHub Update: The solution presented in this article is based on Navigator 1.0 and doesn't support deep linking and URL navigation.
Jul 7, 2018 -- 41 Photo by Brendan Church on Unsplash Today we're going to look at navigation in Flutter. But not just any boring navigation. 😉 No, ladies and gentlemen, we're going to make this...
Here, BottomNavigation is a custom widget that draws the three tabs with the correct colors, using BottomNavigationBar. It takes the currentTab as an input and calls the _selectTab method to update the state as needed. The interesting part is the _buildBody () method.
Flutter Case Study: Multiple Navigators with BottomNavigationBar Preview In this example each tab has its own navigation stack. This is so that we don't lose the navigation history when switching tabs. This is a very common use case for a lot of apps. How is it built? Create an app with a Scaffold and a BottomNavigationBar.
26 If I understand your question correctly, you need the bottom navigation bar persisted on all three pages. There is a well-written article on how to achieve it. You can find the details here. https://medium.com/coding-with-flutter/flutter-case-study-multiple-navigators-with-bottomnavigationbar-90eb6caa6dbf
Flutter Case Study: Multiple Navigators with BottomNavigationBar Preview In this example each tab has its own navigation stack. This is so that we don't lose the navigation history when switching tabs. This is a very common use case for a lot of apps. How is it built? Create an app with a Scaffold and a BottomNavigationBar.
By the way, if you want to learn more about BottomNavigationBar and how to use it to enable multiple independent Navigators, make sure to read my previous article: Flutter Case Study: Multiple Navigators with BottomNavigationBar; Full source code. I open sourced my full example here on GitHub. 🙏. Feel free to reuse it in your projects. 😎
GitHub - bizz84/nested-navigation-demo-flutter: Nested navigation with BottomNavigationBar master 5 branches 0 tags Code 42 commits android Regenerate Android project 2 years ago ios Regenerate Android project 2 years ago lib Updated to Flutter 3.3, Dart 2.18 last year macos Add macOS and web projects 2 years ago screenshots
Multiple Navigators with BottomNavigationBar · Issue #31483 · flutter/flutter · GitHub. flutter / flutter Public. Notifications. Fork 24.9k. Star 151k. Code. Issues 5k+. Pull requests 204.
BottomNavigationBar buildAuthenticatedBottomNavigationBar (BuildContext context) { return BottomNavigationBar ( currentIndex: selectedIndex, onTap: (index) => setState ( () => selectedIndex = index), type: BottomNavigationBarType.fixed, selectedLabelStyle: TextStyle ( fontSize: 8.sp, fontWeight: FontWeight.w600, color: Theme.of (context)...
In Flutter, we have a bottomNavigationBar of a Scaffold. However, unlike iOS, when we Navigator.push to a new screen, this bottomNavigationBar disappears. In my app, I want to fulfil this requirement: Home screen has a bottomNavigationBar with 2 items ( a & b) presenting screen A & B. By default, screen A is displayed.
The bottom navigation bar consists of multiple items in the form of text labels, icons, or both, laid out on top of a piece of material. It provides quick navigation between the top-level views of an app. For larger screens, side navigation may be a better fit. A bottom navigation bar is usually used in conjunction with a Scaffold , where it is ...
Flutter case study: multiple navigators with bottomnavigationbar by and keeping state in bottom navigation bar navigators: a study nested demo migrating native apps to simple task llc aplikacja mobilna w technologii appchance laptrinhx using provider ashish rawat android or ios for retail? you need both grid dynamics blog innovationm all enchantink on the web webview hybrid composition wont ...
Persistent bottom bar https://medium.com/coding-with-flutter/flutter-case-study-multiple-navigators-with-bottomnavigationbar-90eb6caa6dbf Navigation rail via Material ...
Navigator.push(context, MaterialPageRoute(builder: (BuildContext context) { return Container() However, its just pushing the new widget over the entire stack, covoring the BottomNavigationBar. Any tips would be greatly appreciated!
I am implementing multi navigation with bottom navigation bar as shown here; https://medium.com/coding-with-flutter/flutter-case-study-multiple-navigators-with-bottomnavigationbar-90eb6caa6dbf I have put the title text like this.
Here's an app with a BottomNavigationBar: What we want is for each tab to have its own navigation stack. This is so that we don't lose the navigation history when switching tabs. Example: How to build this? Short version: Create an app with a Scaffold and a BottomNavigationBar. In the Scaffold body, create a Stack with one child for each tab.
@chunhtai @johnpryan If/when this is worked on, one thing to keep in mind is that so far with other implementations of multiple navigation stacks, we lose the ability to scroll-to-top in iOS when tapping on the status bar. This is due to a problem with PrimaryScrollController being created above the indexed stack level. If this issue can also be kept in mind while working on this issue would ...
Flutter Bottom Navigation Bar with Multiple Navigators: A Case Study Preview In this example each tab has its own navigation stack. This is so that we don't lose the navigation history when switching tabs. This is a very common use case for a lot of apps. How is it built? Create an app with a Scaffold and a BottomNavigationBar.
BottomNavigationBar is a widget that displays a row of small widgets at the bottom of a Flutter app. Usually, it's used to show around three to five items. Each item must have a label and an icon. BottomNavigationBar allows you to select one item at a time and quickly navigate to a given page.
By the way, if you want to learn more about BottomNavigationBar and how to use it to enable multiple independent Navigators, make sure to read my previous article: Flutter Case Study: Multiple Navigators with BottomNavigationBar; Full source code. I open sourced my full example here on GitHub. 🙏. Feel free to reuse it in your projects. 😎