Closed stepanzalis closed 5 years ago
The problem was that the widget was Stateless
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, ), ], ), ),
Have you tried the @stepanzalis 's solution?
Yes, I using Statefull
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.