【发布时间】:2021-11-26 08:34:41
【问题描述】:
我正在处理一个 Flutter 项目,但我的 TabBar 出现了问题。 我想增加所选图标 tabBar 的大小。有可能吗?我看到我们可以增加文本大小,但它当然不能使用图标。
这是我正在使用的代码:
return DefaultTabController(
length: 5,
child: Container(
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
Theme.of(context).primaryColor,
const Color.fromRGBO(0, 60, 99, 1.0)
]),
),
child: Scaffold(
backgroundColor: Colors.transparent,
appBar: AppBar(
backgroundColor: Colors.transparent,
shadowColor: Colors.transparent,
flexibleSpace: Column(
mainAxisAlignment: MainAxisAlignment.end,
children: const [
TabBar(
tabs: [
Tab(
icon: Icon(
CupertinoIcons.add,
),
),
Tab(
icon: Icon(CupertinoIcons.add),
),
Tab(
icon: Icon(CupertinoIcons.add),
),
Tab(
icon: Icon(CupertinoIcons.add),
),
Tab(
icon: Icon(CupertinoIcons.add),
)
],
unselectedLabelColor: Color.fromRGBO(142, 142, 147, 1),
labelColor: Color.fromRGBO(0, 60, 255, 1),
unselectedLabelStyle: TextStyle(fontSize: 15), // Test with text
labelStyle: TextStyle(
fontSize: 20,
),
),
],
),
),
body: TabBarView(
physics: NeverScrollableScrollPhysics(),
children: [
FirstScreen(),
SecondScreen(),
ThirdScreen(),
FourthScreen(),
FifthScreen()
],
),
),
),
);
我真的卡住了,希望有解决办法!
【问题讨论】:
标签: flutter dart icons size tabbar