![](https://img2020.cnblogs.com/blog/410317/202102/410317-20210226103507477-1966686141.png)
提供了选中与非选中。很简单。
bottomNavigationBar: BottomNavigationBar(
items: const <BottomNavigationBarItem>[
BottomNavigationBarItem(
icon: Icon(Icons.home),
label: 'First',
),
BottomNavigationBarItem(
icon: Icon(Icons.exit_to_app),
label: 'Second',
),
],
selectedLabelStyle: TextStyle(fontSize: 22),
selectedItemColor: Colors.red,
),
增加currentIndex: idx 当前选中项
onTap: (int index) {
setState(() {
this.idx = index;
});
updateUI();
},