bottom_nav_layout
bottom_nav_layout copied to clipboard
Unable to change bottom navigation from buttons on the page
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.
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.