mt-akar / bottom_nav_layout

A quick and powerful Flutter layout with a bottom navbar.
https://pub.dev/packages/bottom_nav_layout
MIT License
35 stars 11 forks source link

Hide navigation bar on new screen #8

Closed DenMarty closed 2 years ago

DenMarty commented 2 years ago

Hi!

To begin with, I will say that this is an excellent solution that is perfectly adapted to any concept. Just love it.

Question: Is it possible to hide nav bar on a certain screen? (Ex: When user logOut from account and gets to the intro screen.) Thanks.

mt-akar commented 2 years ago

Thank you for the compliment.

There are many ways of setting up Flutter navigation. This package helps you set up a same-level-destinations-with-a-bottom-navigation-bar setup, nothing more nothing less.

TLDR; if not logged in, show login screen, when logged in show another screen with the bottom navbar.

How you achieve what you describe is as follows. You need to design a destination that doesn't have a bottom nav layout such as a login screen and another destination with a bottom nav layout which could be the rest of the application. When the application is launched and the user is not logged in, you show the login screen to the user, otherwise, you show the other destination with the bottom bar which is the rest of your app. In this scenario, the decision to show the login screen or not isn't made by the bottom_nav_layout package, it might be made by a simple selector, a navigator, or something else.

You do not hide the bottom_nav_bar per se, rather just don't use it when you don't need it.