以下是我在TabBar
处理Flutter
的代码
TabBar(controller: tabController, indicatorColor: white, tabs: [
Tab(
child: Text(
"Present",
style: TextStyle(fontFamily: "BarlowBold", color: black),
),
),
Tab(
child: Text(
"Upcoming",
style: TextStyle(fontFamily: "BarlowBold", color: black),
),
)
]),
我需要根据选择的选项卡更改文本的fontFamily
。我尝试了tabController
的属性,但他们没有帮助
同样可以使用labelStyle:
的unselectedLabelStyle:
和TabBar
TabBar(
indicatorColor: Colors.white,
labelStyle: TextStyle(fontSize: 22.0,fontFamily: 'Family Name'), //For Selected tab
unselectedLabelStyle: TextStyle(fontSize: 10.0,fontFamily: 'Family Name'), //For Un-selected Tabs
tabs: [