Flutter 更改选项卡中标签的文字样式
这看起来很直截了当。我正在尝试更改选项卡标签的文本样式。这是我的标签小部件Flutter 更改选项卡中标签的文字样式,flutter,Flutter,这看起来很直截了当。我正在尝试更改选项卡标签的文本样式。这是我的标签小部件 TabBar( unselectedLabelStyle: TextStyle(fontSize: 22.0,color: Colors.red), labelStyle: TextStyle(fontSize: 22.0,color: Colors.red), tabs: [ if
TabBar(
unselectedLabelStyle: TextStyle(fontSize: 22.0,color: Colors.red),
labelStyle: TextStyle(fontSize: 22.0,color: Colors.red),
tabs: [
if (venue.availableService.supportsChat)Text('chat'),
if (venue.availableService.supportsTableService) Text('Table'),
if (venue.availableService.supportsCollection) Text('Collection'),
if (venue.availableService.supportsDelivery) Text('Delivery'),
],
controller: tabController,
),
如何将标签连接到文本小部件
编辑:
可能应该使用选项卡小部件:tab(文本:chat)
但仍然没有达到预期效果。简单:
final List<Widget> myTabs = [
Tab(
child: Text(
'Top Rated',
style: TextStyle(
fontFamily: kFontFamily,
fontSize: 14,
fontWeight: FontWeight.w600,
//color: Color(0xFF818181),
//color: kPrimaryColor,
),
),
),
Tab(
child: Text(
'Newest',
style: TextStyle(
fontSize: 14,
fontFamily: kFontFamily,
fontWeight: FontWeight.w600,
//color: kPrimaryColor,
),
),
)];
TabBar(
isScrollable: true,
labelColor: Colors.white,
unselectedLabelColor: Colors.black,
controller: _controller,
indicatorColor: kAccentColor,
physics: BouncingScrollPhysics(),
indicator: BoxDecoration(
borderRadius: BorderRadius.circular(7),
color: Color.fromRGBO(255, 87, 157, 1),
),
tabs: myTabs,
),