【发布时间】:2021-01-17 09:45:40
【问题描述】:
我正在修改应用程序布局并使用导航栏,但无论我是否按下它,我的第一个项目总是被激活。有什么想法吗?
我的标签在第一项之后也没有显示。
@override
Widget build(BuildContext context) {
return Scaffold(
floatingActionButton: FloatingActionButton(
onPressed: _incrementCounter,
tooltip: 'Increment',
child: Icon(Icons.add),
),
bottomNavigationBar: BottomAppBar(
notchMargin: 5,
shape: CircularNotchedRectangle(),
// color: Colors.black,
child:
BottomNavigationBar(
elevation: 50,
//backgroundColor: Colors.black,
unselectedItemColor: Colors.black,
selectedItemColor: Colors.green,
items: [
//the first one is always activated
BottomNavigationBarItem(
icon: Icon(Icons.accessibility_new),
label: ("Lo"),
activeIcon: Icon(Icons.book),
//IF I add background color here it will fill the entire bar
//backgroundColor: Colors.green,
),
BottomNavigationBarItem(
icon: Icon(Icons.book),
label: ("Ed"),
),
BottomNavigationBarItem(
icon: Icon(Icons.access_time),
label: ("Pi"),
),
BottomNavigationBarItem(
icon: Icon(Icons.accessible_sharp),
label: ("ac"),
),
],
),
),
);
}
}
【问题讨论】:
标签: flutter navigationbar