【flutter BottomNavigationBar 】selectedLabelStyle: TextStyle(fontSize: 22) 更新后使用方法

 

提供了选中与非选中。很简单。



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();
},


posted on 2021-02-26 10:33  wp7ers  阅读(328)  评论(0)    收藏  举报