Flutter bottomnavigation - flutter

How do I achieve that red bottomnavigation button?
I am using a floating action button on the app but I only want to use the styling of the bottomnavigation for onSelected or something like that.

You can build your own bottom nav bar. For example with an column where you place the Nav bar as Container with an fixed height (for Android around 56.0 px) to the bottom and inside the container place the row Widget where each children is one of your nav bar items.
So If you want to highlight the selected nav bar item just use an container as wrapper of your nav bar item and give this one the color like that:
color: activeNavItemId == <idOfYourNavItem>
? Color.red
: Color.black;
Note: So every time you click on one of this nav bar items you have to set the activeNavItemId with the id of this button and then call setState.

Related

BottomNavigatorBar vs Tabbar on Flutter

I know how can I use tabbar or bottomNavigatorBar. I can create bottom bar with both of them but my question is which one is the best usage to create bottom bar? I mean, which one should I use to create bottom bar?
It will be design based, how you prefer. I prefer using BottomNavigatorBar for <=5 destination. Else, use with Tabbar sometimes.
Let's check the Google material about bottom-navigation
Bottom navigation bars display three to five destinations at the bottom of a screen. Each destination is represented by an icon and an optional text label. When a bottom navigation icon is tapped, the user is taken to the top-level navigation destination associated with that icon.

is this the right method instead using bottom bar navigation

I am new to Flutter. As I understand Bottom Bar Navigation is used for quick navigation between the top-level views of an app. but in my situation, I want to use like this which only button PAY can be clicked.
so is it okay if Im not using BottomBar instead i use as container and place it at bottom?
ya ,The best way is that you can create a container and the button and place it child of bottomNavigationBar so the flutter is automaticaly align it in bottom side
bottomNavigationBar: Container(child: yourcodeHere),

A mixed mode Flutter Bottom Navigation bar

I am wanting to include a Bottom Navigation Bar in my application that will be displayed on some pages but not other.
As I understand the the Flutter BottomNavigationBar widget re-renders the Scaffold Body property and does not actually route to another page and always shows the navigation bar. Would anyone have some advice on how I can have a bottom navigation that would look like the following where Tab 1 and Tab 3 route to a screen showing the navigation bar and Tab 2 and Tab 3 are screens that don't show the navigation bar?
Bottom Navigation Bar
I believe you want to show the bottomNavBar in tab 1and 3 while hiding it in 2 and 4 right? I presume you have a variable that keeps track of the selected index lets call it int _selectedIndex = 0. In the bottomNavigation property you can show and not show it like below
bottomNavigationBar: _selectedIndex.isEven ? null: BottomNavigationBar()
Here it checks the _selectedIndex value (0,1,2,3 in this case) and if that is odd you show the page and the navigations (Tab 1 & 3) while if it is even (Tab 2 & 4) then you supply a null thus not showing the navigation. The only concern becomes how to navigate outside the two tabs without navigation but this should solve your immediate problem

How can I make this custom app bar in flutter(android)?

I am trying to create a android tab bar like this image custom tab bar in flutter.
How can I make a tab bar like this?
There are so many examples for your questions you can check the links. Also appbar is a widget on the top of the screen and has buttons. You can create a buttons in the scaffold widget and put them top of the screen still same but easy to decorate and use.
Custom AppBar Flutter
Custom AppBar

Make multiple scaffold with single Tabs bar

I am building a flutter app where the user requirement is to build 3 tabs with each tab having custom AppBar which implies to have multiple Scaffolds in each view.
So I have main.dart, screen.dart, account.dart and post.dart
3 tabs => Screen, Account and Post
Screen View => Appbar with just name
Account View => Appbar with Hamburger Icon
Post View => Appbar with Plus icon
According to flutter we can have Appbar and Bottom Navigation Bar (Tabs Bar) inside Scaffold Widget. So to have multiple Scaffolds, I would have to make 3 seperate bottom navigation bar or is there any other way to achieve this functionality?
Also, if we need to make 3 different Bottom Navigation Bar per Scaffold, then how to navigate between them since my first view will be called from main.dart
Thanks for helping and taking out your time to answer the question.