flutter中TabBar背景颜色设置
TabBar本身不提供修改背景颜色的方法,如果需要修改背景颜色的话,需要另辟蹊径.
Scaffold(
key: _key,
appBar: AppBar(
title: Text("技术咸鱼"),
bottom: PreferredSize(
preferredSize: Size.fromHeight(48),
child: Material(
//TabBar背景颜色
color: Colors.blue,
child: TabBar(
indicatorColor: Colors.black,
controller: _tabController,
labelColor: Colors.white,
unselectedLabelColor: Colors.red,
tabs: _tabs.map((item)=>Tab(text: item,)).toList(),
),
),
)
),
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
- 01
- DNS解析主机记录www和@的区别09-16
- 03
- flutter构建为 Web 应用07-27