Reputation: 2415
I am currently using persistent_bottom_nav_bar: ^4.0.2
package of flutter which showing 3 screens (A,B,C screens) in the bottom tab navigator. In the first screen I have a button that navigate user to another screen (D screen). The problem is the bottom tab navigator (persistent_bottom_nav_bar) is still showing in D screen, while the main screens are AB,C. Is there a way to hide persistent_bottom_nav_bar when the screen is not one of three main screen ?
Upvotes: 2
Views: 1778
Reputation: 136
The navigation to other screens form the screens you are displaying Bottom Nav Bar should by done by using this function:
PersistentNavBarNavigator.pushNewScreen( context, screen: newScreen(), withNavBar: false, );
Use this instead of Navigator.push or other navigation functions.
Upvotes: 0
Reputation: 21
I think there is a nice feature that comes with the plugin itself (check out the documentation on pub.dev here https://pub.dev/packages/persistent_bottom_nav_bar, it's allowed you to navigate to a new screen without the navbar and when you pop back the navbar will show
try this
PersistentNavBarNavigator.sepushNewScreen();
there are some parameters that are required "screen & context" which is the screen you want to navigate to.
the parameter "withNavBar" it's a bool (optional) when you pass false the navbar will not show on the new screen!
you could try this after importing
PersistentNavBarNavigator.pushNewScreen(
context,
screen: newScreen(),
withNavBar: false,
);
Upvotes: 2
Reputation: 247
can you check persistent_bottom_nav_bar in example code.
onScreenHideButtonPressed: () {
setState(() {
_hideNavBar = !_hideNavBar;
});
},
Upvotes: 0