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

BottomNavyBarItem is not selected #20

Closed stepanzalis closed 5 years ago

stepanzalis commented 5 years ago

When the app is loaded, the navigation item is not selected by default, I have to manually tap to the current item to show overlay on the top of it.

stepanzalis commented 5 years ago

The problem was that the widget was Stateless

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('testo'), activeColor: Colors.red, inactiveColor: Colors.grey, ), BottomNavyBarItem( icon: Icon(Icons.people), title: Text('Testo2'), activeColor: Colors.green, inactiveColor: Colors.grey ), BottomNavyBarItem( icon: Icon(Icons.message), title: Text('DESS'), activeColor: Colors.deepPurple, inactiveColor: Colors.grey, ), BottomNavyBarItem( icon: Icon(Icons.settings), title: Text('Notificaciones'), activeColor: Colors.blue, inactiveColor: Colors.grey, ), ], ), ),

pedromassango commented 5 years ago

Have you tried the @stepanzalis 's solution?

superaldo commented 5 years ago

Yes, I using Statefull