【问题标题】:How to add underline to unselected tabs in Flutter?如何在 Flutter 中为未选择的选项卡添加下划线?
【发布时间】:2020-07-18 06:36:17
【问题描述】:

如何为未选中的标签添加下划线,如下所示:

您可以看到未选中的选项卡为灰色,选中的选项卡为蓝色。我想要根据我的应用颜色选择未选择标签的未划线颜色。

【问题讨论】:

    标签: android flutter tabs uitabbarcontroller uitabbar


    【解决方案1】:

    您可以使用标签来实现这一点

    Scaffold(
              appBar: AppBar(
                bottom: TabBar(
                  tabs: [
                    Tab(text:"About"), // you can specify pages here if you want
                    Tab(text:"Reg"),
                    Tab(text:"Services"),
                   
                  ],
                ),
                title: Text('Tabs Demo'),
              ),
              body: TabBarView(
                children: [
                  Text("1"),
                  Text("2"),
                  Text("3"),
             
                ],
              ),
            ),
    

    【讨论】:

    • 基本上我想将颜色从银色更改为其他颜色,如红色。有没有可能?
    • indicatorColor : 你想要的颜色
    • 如果我使用 indicatorColor : Colors.red,那么它会更改选定选项卡的颜色,我想更改其他人的颜色。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-01-20
    • 1970-01-01
    • 2018-12-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多