dart - 首次启动时显示双 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.
);
}
作为参考,我正在添加应用程序的屏幕截图
解决方案
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.
推荐阅读
- qt - 在 Qt 的设计视图和代码视图中更改小部件的名称
- google-apps-script - 如何仅将电子邮件发送到谷歌表格中选定的电子邮件?
- sql - 根据条件从另一个表中插入一个表中的记录
- python - Pandas - 连接两个数据框并在新列上添加列值
- c# - 在 API 中使用 ActionResult 类方法
- sql-server - ConnectionError [SequelizeConnectionError]:无法连接到 localhost:1433 - 无法连接(序列)Node.js、Sequelize 和 Heroku
- python - NumPy 中高级索引的结果形状
- python - 有没有办法循环遍历熊猫数据框并根据条件删除行窗口?
- python - 现有数据库中的用户登录 Django 网站的问题
- arrays - 从 0,0 开始寻找棋盘上所有 3 个角的路径不起作用