pedromassango / bottom_navy_bar

A beautiful and animated bottom navigation
https://youtu.be/jJPSKEEiN-E
Apache License 2.0
1.04k stars 219 forks source link

When the app is loaded the navigation item #21

Closed superaldo closed 5 years ago

superaldo commented 5 years ago

I have the same issue and is inside of a Stetefull widget, I put the BottomNavyBar in the bottom part of the Appbar using PreferredSize, and when the app is loaded the navigation item is not selected by default.

bottom: PreferredSize(
            preferredSize: Size(0,40),
            child: BottomNavyBar(
              onItemSelected: (index) => setState(() {
                  _index = index;
                  _controllerTab.animateTo(_index);
              }),
              items: [
                BottomNavyBarItem(
                  icon: Icon(Icons.chrome_reader_mode),
                  title: Text('Referendum'),
                  activeColor: Colors.red,
                  inactiveColor: Colors.grey,
                ),
                BottomNavyBarItem(
                    icon: Icon(Icons.people),
                    title: Text('Pagar'),
                    activeColor: Colors.green,
                    inactiveColor: Colors.grey
                ),
                BottomNavyBarItem(
                    icon: Icon(Icons.message),
                    title: Text('Derechos'),
                    activeColor: Colors.deepPurple,
                    inactiveColor: Colors.grey,
                ),
                BottomNavyBarItem(
                    icon: Icon(Icons.settings),
                    title: Text('Notificaciones'),
                    activeColor: Colors.blue,
                    inactiveColor: Colors.grey,
                ),
              ],
            ),
          ),
london-tokyo commented 5 years ago

Did you find the right way?

pedromassango commented 5 years ago

Looks like you have not implemented the selectedIndex property. I'll close this for now feel free to re-open it again if neccessary