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

Unable to change bottom navigation from buttons on the page #15

Open AniketDhanak opened 2 years ago

AniketDhanak commented 2 years ago

I want change the current bottom navigation bar to another. Like: When I click on add to cart button from product detail page it should show selected bottom navigation bar to cart page. Currently It shows me the page but selected page is still homepage.

Also I can't handle navigation from button on the pages to change bottom navigation.

mt-akar commented 1 year ago

Sorry for the late response.

First of all, this is a layout package. It doesn't include a bottom navigation bar. You need to bring your own. If the navigation bar you are using is faulty, you need to address that problem.

Secondly, please make sure that you are passing all parameters correctly. Look at how the currentIndex and onTap parameters are properly passed down in the Quick start example:

bottomNavigationBar: (currentIndex, onTap) => BottomNavigationBar(
  currentIndex: currentIndex,
  onTap: (index) => onTap(index),
  items: [
    BottomNavigationBarItem(icon: Icon(Icons.home), label: 'Home'),
    BottomNavigationBarItem(icon: Icon(Icons.linear_scale), label: 'Slider'),
    BottomNavigationBarItem(icon: Icon(Icons.search), label: 'Search'),
  ],
),

My guess is that you are not passing the currentIndex down to the navigation bar here.

If that still doesn't solve your problem, please update the package and provide a minimal code that reproduces the problem.