Make multiple scaffold with single Tabs bar - flutter

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.

Related

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

Navigation drawer is not opening from APPBar widget in flutter

I have an appbar which is used in more than one screen. I have a navigation drawer in the home screen. As the appbar is used in multiple places, i created as a separate widget. But I am not able to access navigation drawer. So I included appbar code in all the screens I needed. Then it works fine. But it will be code duplicate. Is there any fix for this in Flutter?
Thanks.
If you have not done so yet , you can make a separate class for drawer
getAppDrawer(){
return Drawer(
//your code
);
}
and then you can call this in your others screen
drawer : getAppDrawer(),
you can also do this for the appbar
Take a look at the examples here
and here

Flutter TabController - push screens inside of any particular tabitem

I have a TabController in flutter which has 4 TabItems. How to push screens inside on any particular tab item with back navigation? instead of opening a new screen which covers the full screen and hides the Tab bar.
Finally after some research, i have achieved this with Cupertino Widgets. Using CupertinoTabScaffold and CupertinoTabBar this can be done.

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

Flutter bottomnavigation

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.