The space between the items in the Bottom Navigation Bar

The space between the items in the Bottom Navigation Bar

Problem Description:

  bottomNavigationBar: BottomNavigationBar(
    showSelectedLabels: false,
    showUnselectedLabels: false,
    items: const <BottomNavigationBarItem>[
      BottomNavigationBarItem(
        icon: FaIcon(
          FontAwesomeIcons.solidCompass,
          color: darkblue,
        ),
        label: 'Home',
      ),
      BottomNavigationBarItem(
        icon: FaIcon(
          FontAwesomeIcons.route,
          color: darkblue,
        ),
        label: 'Routes',
      ),
      BottomNavigationBarItem(
        icon: FaIcon(
          FontAwesomeIcons.circlePlus,
          color: darkblue,
        ),
        label: 'Add',
      ),
      BottomNavigationBarItem(
        icon: FaIcon(
          FontAwesomeIcons.solidMessage,
          color: darkblue,
        ),
        label: 'Chat',
      ),
    ],

enter image description here

I created such a BottomNavigationBar and added items to it, but the first item looks very separate from the others. How do I get the spacing between all items to be the same?

Solution – 1

You need to set "type: BottomNavigationBarType.fixed," to set the same width on all the items. The space you see is on the selected index.

Like this:

BottomNavigationBar(
    type: BottomNavigationBarType.fixed,
    ...
)
Rate this post
We use cookies in order to give you the best possible experience on our website. By continuing to use this site, you agree to our use of cookies.
Accept
Reject