我的应用程序中有一个BottomNavigationBar()
,但是在更新到Flutter 1.22之后,title
参数已弃用。由于新标签仅接受String
输入,因此我无法通过Text()
小部件来传递自定义TextStyle
。现在如何通过新更新实现这一目标?
BottomNavigationBarItem(icon: Icon(Icons.notifications), label: 'tickets'),
BottomNavigationBarItem(icon: Icon(CustomIcons.calendar), label: 'calendar'),
BottomNavigationBarItem(icon: Icon(CustomIcons.home), label: 'home'),
BottomNavigationBarItem(icon: Icon(CustomIcons.podcasts), label: 'microphone'),
BottomNavigationBarItem(icon: Icon(CustomIcons.search), label: 'search')
答案 0 :(得分:2)
BottomNavigationBar(
selectedLabelStyle: TextStyle(),//your text style
unselectedLabelStyle: TextStyle(),// your text style
items: [
BottomNavigationBarItem(icon: Icon(Icons.notifications), label: 'tickets'),
BottomNavigationBarItem(icon: Icon(CustomIcons.calendar), label: 'calendar'),
BottomNavigationBarItem(icon: Icon(CustomIcons.home), label: 'home'),
BottomNavigationBarItem(icon: Icon(CustomIcons.podcasts), label:
'microphone'),
BottomNavigationBarItem(icon: Icon(CustomIcons.search), label: 'search'),
]
)