Answers for "how to make a BottomNavigationBarItem not clickable in flutter"

1

how to make a BottomNavigationBarItem not clickable in flutter

You can do something like below:

Your bottomNavigationBar

bottomNavigationBar: BottomNavigationBar(
  items: [
    BottomNavigationBarItem(
      ...
    ),
    BottomNavigationBarItem(
      ...
    ),
    BottomNavigationBarItem(
      ...
    ),
  ],
  onTap: navigationTapped,
  currentIndex: _page,
),
You can add the conditional check whether the page index match with the current index than don't do anything and return from that point.

Like page == index

Where, index is position of the BottomNavigationBarItem

void navigationTapped(int page) {
  if (page == 1) {
    return;
  } else {
    setState(() {
      _selectedIndex = page;
    });
  }
}
Posted by: Guest on April-23-2022
1

how to make a BottomNavigationBarItem not clickable in flutter

void navigationTapped(int page) {
  if (page == 1) {
    return;
  } else {
    setState(() {
      _selectedIndex = page;
    });
  }
}
Posted by: Guest on April-23-2022

Code answers related to "how to make a BottomNavigationBarItem not clickable in flutter"

Browse Popular Code Answers by Language