Home > Mobile >  How to show bottom navigation bar in page that is not in the navigation item list in flutter?
How to show bottom navigation bar in page that is not in the navigation item list in flutter?

Time:10-21

I have 6 pages(just for example but actually more for big app) for my app and I think that only 4 items in bottom navigation bar is more than enough. So that I put page 1 to 4 in navigation bar and navigation correctly.

So I need to go to another two more pages, page 5 and page 6.

These two page can go from page 4. I will use page 4 like menu. Ok, my question is how to put bottom navigation bar on page 5 and page 6.

Regards, Alex

CodePudding user response:

I think you mean how to start the app from page 5 or 6 (you can comment if i'm wrong).

If you use PageView, you should just change the index of your navigation bar, you can set your selectedIndex variable to 4 if you want to start with page 5, like that :

int _selectedIndex = 4;

And If you wanted to have the first icon to be page 5, you can just change the order of your PageView, like that :

body: PageView(
            physics: const NeverScrollableScrollPhysics(),
            controller: pageController,
            children: [
              const Page4(),
              const Page5(),
              const Page1()
              const Page2()
            ]),

Here, the pages are other fonctions (files), but it can work anyway you want (for exemple if you use containers you can also do it, the method is the same).

CodePudding user response:

I use Persistence Bottom Navigation Bar package.

persistence_bottom_navigation_bar

  • Related