【发布时间】:2021-10-24 01:52:58
【问题描述】:
有没有一种方法可以使底部导航栏上的项目无法点击且无法路由到任何地方?我的问题可能没有意义。
谢谢。
【问题讨论】:
-
我的回答对你没有帮助吗?
有没有一种方法可以使底部导航栏上的项目无法点击且无法路由到任何地方?我的问题可能没有意义。
谢谢。
【问题讨论】:
假设您想在导航栏中停用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 或更改反应索引的 color 和 style。
【讨论】: