bottom_nav_layout icon indicating copy to clipboard operation
bottom_nav_layout copied to clipboard

Unable to change bottom navigation from buttons on the page

Open AniketDhanak opened this issue 2 years ago • 1 comments

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.

AniketDhanak avatar Jun 14 '22 06:06 AniketDhanak

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.

mt-akar avatar Jan 18 '23 23:01 mt-akar