Search code examples
flutterbottomnavigationview

Flutter - Disable Bottom Navigation Bar Animation (growing text)


I want to disable the Bottom Navigation Bar animation for selected item to get the same text/icon size of unselected items.

That's my code:

 class BottomNavigationBarHome extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return BottomNavigationBar(
        unselectedItemColor: Colors.black38,
        backgroundColor: Colors.white,
        items: [
          BottomNavigationBarItem(
              icon: Icon(BalanceIcon.scale_balance, size: 15.0),
              title: Text('Item 1', style: TextStyle(

              ),)
          ),
          BottomNavigationBarItem(
              icon: Icon(BalanceIcon.scale_balance),
              title: Text('Item 2')
          ),
          BottomNavigationBarItem(
              icon: Icon(BalanceIcon.scale_balance),
              title: Text('Item 3')
          ),
        ]
    );
  }
}

I have already tried setting the same font size, the animation is still here


Solution

  • You can try add type to BottomNavigationBar

    BottomNavigationBar(
        type: BottomNavigationBarType.fixed,
        ...
    )