Flutter更改制表符宽度

问题描述 投票:0回答:1

我有四个选项卡,最后一个是带有图标的选项卡。我想更改最后一个标签的宽度,使其更小。所以,看起来会更好。使用Container并指定宽度无效。有什么建议可以使它起作用吗?

enter image description here

TabBar(
  controller: _controller,
  labelColor: Color(0xff666666),
  indicatorColor: Colors.transparent,
  unselectedLabelColor: Color(0xff666666),
  tabs: <Widget>[
    GestureDetector(
      onTap: () {
        widget.onItemTapped(5);
      },
      child: Tab(
        text: 'Explore',
      ),
    ),
    GestureDetector(
      onTap: () {
        Navigator.pushNamed(context, '/bookService');
      },
      child: Tab(
        text: 'Book Service',
      ),
    ),
    Tab(
      text: 'Shop',
    ),
    Tab(
      icon: Icon(
        FontAwesomeIcons.inbox,
      ),
    ),
  ],
),
flutter flutter-layout
1个回答
0
投票

尝试将以下内容添加到TabBar小部件中

isScrollable: true,
labelPadding: EdgeInsets.symmetric(horizontal: 10.0),
© www.soinside.com 2019 - 2024. All rights reserved.