Flutter 颤振标签未正确加下划线

Flutter 颤振标签未正确加下划线,flutter,Flutter,我有以下选项卡: class _HomeState extends State<Home> { int _currentIndex = 0; final List<Widget> _children = [ DefaultTabController( length: 3, child: Scaffold( appBar: AppBar( flexibleSpace: S

我有以下选项卡:

class _HomeState extends State<Home> {

  int _currentIndex = 0;

  final List<Widget> _children = [
    DefaultTabController(
        length: 3,
        child: Scaffold(
            appBar: AppBar(
              flexibleSpace: SafeArea(
                child: TabBar(
                  tabs: [
                    Tab(icon: Icon(FontAwesomeIcons.listAlt)),
                    Tab(icon: Icon(FontAwesomeIcons.map)),
                    Tab(icon: Icon(FontAwesomeIcons.cog))
                  ],
                )
              )
            ),
            body: TabBarView(
              children: [
                TrendingList(),
                TrendingMap(),
                TrendingConfiguration()
              ],
            )
        )
    ),
    PlaceholderWidget(Colors.white),
    PlaceholderWidget(Colors.deepOrange),
    PlaceholderWidget(Colors.green)
  ];

  void onTabTapped(int index) {
    setState(() {
      _currentIndex = index;
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: _children[_currentIndex],
      bottomNavigationBar: BottomNavigationBar(
        onTap: onTabTapped,
        currentIndex: _currentIndex,
        type: BottomNavigationBarType.fixed,
        items: [
          BottomNavigationBarItem(
            icon: new Icon(FontAwesomeIcons.chartLine),
            title: new Text('Trending'),
          ),
          BottomNavigationBarItem(
            icon: new Icon(FontAwesomeIcons.glasses),
            title: new Text('Watchlist'),
          ),
          BottomNavigationBarItem(
              icon: Icon(FontAwesomeIcons.user),
              title: Text('Me'),
          ),
          BottomNavigationBarItem(
            icon: Icon(FontAwesomeIcons.bell),
            title: Text('Notifications'),
          )
        ],
      ),
    );
  }
}
class\u HomeState扩展状态{
int _currentIndex=0;
最终列表_子项=[
默认选项卡控制器(
长度:3,
孩子:脚手架(
appBar:appBar(
灵活空间:安全区域(
孩子:TabBar(
选项卡:[
选项卡(图标:图标(FontAwesomeIcons.listAlt)),
选项卡(图标:图标(FontAwesomeIcons.map)),
选项卡(图标:图标(FontAwesomeIcons.cog))
],
)
)
),
正文:选项卡视图(
儿童:[
趋势列表(),
趋势图(),
趋势配置()
],
)
)
),
占位符小部件(颜色。白色),
占位符小部件(颜色为深橙色),
占位符小部件(颜色.绿色)
];
void onTabTapped(整数索引){
设置状态(){
_currentIndex=索引;
});
}
@凌驾
小部件构建(构建上下文){
返回脚手架(
正文:_children[_currentIndex],
底部导航栏:底部导航栏(
onTap:onTabTapped,
currentIndex:_currentIndex,
类型:BottomNavigationBarType.fixed,
项目:[
底部导航气压计(
图标:新图标(FontAwesomeIcons.chartLine),
标题:新文本(“趋势”),
),
底部导航气压计(
图标:新图标(FontAwesomeIcons.glass),
标题:新文本(“观察列表”),
),
底部导航气压计(
图标:图标(FontAwesomeIcons.user),
标题:文本(“我”),
),
底部导航气压计(
图标:图标(FontAwesomeIcons.bell),
标题:文本(“通知”),
)
],
),
);
}
}
其结果如下:

为什么我的标签没有正确地加下划线?我如何修复它?

我不想要头衔

使用
TabBar
的正确位置是
AppBar
bottom

如文件所述——

底部通常用于选项卡栏

代码:

更新:

代码:没有标题

appBar: AppBar(
              flexibleSpace: SafeArea(
                child: SizedBox(
                  height: kToolbarHeight,
                  child: TabBar(
                    tabs: [
                      Tab(icon: Icon(FontAwesomeIcons.listAlt)),
                      Tab(icon: Icon(FontAwesomeIcons.map)),
                      Tab(icon: Icon(FontAwesomeIcons.cog))
                    ],
                  ),
                ),
              ),
              bottom: PreferredSize(child: SizedBox(), preferredSize: Size.zero),
            ),

与此同时,我发现了一个带有漂亮气泡标签的插件。如前所述,我不想要标题,上面的空导航栏将有不同的用途。这段代码实现的是出现了一个空(双)appbar。@Trace-Updated答案。我已经回答了这个问题,可以在这里查看一下
appBar: AppBar(
              flexibleSpace: SafeArea(
                child: SizedBox(
                  height: kToolbarHeight,
                  child: TabBar(
                    tabs: [
                      Tab(icon: Icon(FontAwesomeIcons.listAlt)),
                      Tab(icon: Icon(FontAwesomeIcons.map)),
                      Tab(icon: Icon(FontAwesomeIcons.cog))
                    ],
                  ),
                ),
              ),
              bottom: PreferredSize(child: SizedBox(), preferredSize: Size.zero),
            ),