如何根据选择的选项卡更改样式?
How to change style depending on which tab is selected?
以下是我在 Flutter
中处理 TabBar
的代码
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:
of 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: [
以下是我在 Flutter
TabBar
的代码
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:
of 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: [