![](/img/trans.png)
[英]How to make Flutter BottomNavigationBarItem icon and label in same line
[英]BottomNavigationBarItem label not showing when selected in flutter
這里的代碼是:
BottomNavigationBar(
selectedLabelStyle: TextStyles.labelSelectedTextStyle,
unselectedLabelStyle: TextStyles.labelUnSelectedTextStyle,)
Two different styles added for navigation items, but when selected the item label is not showing.
為此,分別添加 colors,如下所示:
selectedLabelStyle: TextStyles.labelSelectedTextStyle,
unselectedLabelStyle: TextStyles.labelUnSelectedTextStyle,
selectedItemColor: Colors.blue,
unselectedItemColor: Colors.red,
也許現在有人會面臨同樣的問題。 目前 class BottomNavigationBar 有屬性showUnselectedLabels ,默認為false 。 因此,要使 BottomNavigationBarItem 中的標簽顯示,您需要設置以下屬性:
showUnselectedLabels: true,
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.