首页 > 解决方案 > 首次启动时显示双 FAB 按钮

问题描述

我正在开发 Flutter 应用程序并在底部导航栏的中心添加了一个 FAB 按钮。但是当我启动应用程序时,我发现显示了 2 个单独的 FAB 按钮。

我正在使用以下代码:

@override
  Widget build(BuildContext context) {
    // TODO: implement build
    return Scaffold(
      appBar: AppBar(
        title: new Text("itsmee."),
      ),
      drawer: sideDrawer(),
      body: _loadTabbedScreen(),
      bottomNavigationBar: FABBottomAppBar(
//        centerItemText: 'A',
        color: Colors.grey,
        selectedColor: Colors.red,
        notchedShape: CircularNotchedRectangle(),
        onTabSelected: _selectedTab,
        items: [
          FABBottomAppBarItem(iconData: Icons.home, text: 'Home'),
          FABBottomAppBarItem(iconData: Icons.search, text: 'Search'),
          FABBottomAppBarItem(iconData: Icons.favorite, text: 'Review'),
          FABBottomAppBarItem(iconData: Icons.person, text: 'Profile'),
        ],
      ),
      floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
      floatingActionButton: _buildFab(context), // This trailing comma makes auto-formatting nicer for build methods.
    );
  }

作为参考,我正在添加应用程序的屏幕截图

在此处输入图像描述

标签: dartflutter

解决方案


It looks like you are using both BottomNavigationBar and likely Scaffold too. Take a look at where your Scaffold is defined as that's whee the FAB over the Profile is created.


推荐阅读