Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 523
Arfmann Avatar asked Jun 13 '20 14:06

Arfmann


2 Answers

You can try add type to BottomNavigationBar

BottomNavigationBar(
    type: BottomNavigationBarType.fixed,
    ...
)
like image 88
dangngocduc Avatar answered Nov 08 '22 12:11

dangngocduc


Add selectedFontSize & unselectedFontSize in BottomNavigationBar and set the same font sizes

BottomNavigationBar(
        selectedFontSize: 15.0,
        unselectedFontSize: 15.0,
like image 2
Jitesh Mohite Avatar answered Nov 08 '22 13:11

Jitesh Mohite