【发布时间】:2021-11-20 04:52:30
【问题描述】:
我已经在我的AppBar() 中实现了TabBar()。
现在,选项卡之间有额外的空间。我在 Chrome(网络)上运行它。我尝试在TabBar() 内的indicatorPadding、labelPadding 和padding 参数中添加零填充,但没有任何东西会缩小标签栏项目。
那么我怎样才能减少它们之间的空间呢?代码如下:
Widget build(BuildContext context) {
return Container(
height: height,
color: Colors.white,
child: TabBar(
indicatorColor: Colors.black,
unselectedLabelColor: Colors.black54,
indicatorSize: TabBarIndicatorSize.label,
labelColor: Colors.black,
labelStyle: const TextStyle(
fontSize: 12,
),
tabs: [
Container(
color: Colors.red,
child: const Tab(
icon: Icon(Icons.home_rounded),
text: "Home",
iconMargin: EdgeInsets.zero,
),
),
Container(
color: Colors.green,
child: const Tab(
icon: Icon(Icons.groups_rounded),
iconMargin: EdgeInsets.zero,
text: "My Network",
),
),
const Tab(
iconMargin: EdgeInsets.zero,
icon: Icon(
Icons.work_rounded,
// size: 20,
),
text: "Jobs",
),
const Tab(
iconMargin: EdgeInsets.zero,
icon: Icon(Icons.message_rounded),
text: "Messaging",
),
const Tab(
iconMargin: EdgeInsets.zero,
icon: Icon(Icons.notifications_rounded),
text: "Notification",
),
],
));
}
}
【问题讨论】:
标签: flutter flutter-layout tabbar