颤振底部导航条使项目没有路线



是否有一种方法可以使底部导航栏上的项目不可点击而不会路由到任何地方?

假设您想在导航栏中禁用deactiveIndex。使用:

bottomNavigationBar: BottomNavigationBar(
items: const <BottomNavigationBarItem>[
BottomNavigationBarItem(
icon: Icon(Icons.home),
label: 'Home',
),
BottomNavigationBarItem(
icon: Icon(Icons.business),
label: 'Business',
),
BottomNavigationBarItem(
icon: Icon(Icons.school),
label: 'School',
),
],
currentIndex: _selectedIndex,
selectedItemColor: Colors.amber[800],
onTap:(index){
if(index == deactiveIndex){ return;}
setState((){_selectedIndex=index});
},
),

对于更多的UI表示,您可以为活动索引设置activeIcon或更改活性索引的colorstyle

最新更新