[英]Flutter: how to change label style color when it is selected
我想在選擇選項卡時將顏色更改為藍色,當未選擇選項卡時將顏色更改為灰色我已經這樣做了
TabBar(
isScrollable: true,
labelStyle: TextStyle(
fontSize: 14.0,
fontFamily: 'fontfamily',
color: Colors.blue),
unselectedLabelStyle:
TextStyle(
fontSize: 14.0, fontFamily: 'fontfamily'),
tabs: myTabs,
controller: _tabController,
),
你可以使用這個:
labelColor: Colors.blue,
unselectedLabelColor: Colors.grey,
您不必在 labelStyle 中指定文本顏色
unselectedLabelColor: Colors.grey, //for unselected label//
indicatorColor: Colors.grey, //indicates the label color when you click it//
labelColor: Colors.blue, // shows the label color //
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.