所以我有这个扑扑的应用程序,并且我试图隐藏或删除标题。我试图将标题保留为空字符串,即,new Text("")但与导航栏的对齐方式混淆了。
期望的结果:
我得到什么(如果我将标题保留为空字符串):
Ika*_*ský 22
现在,您只需为选定或未选定的项目禁用标签:
bottomNavigationBar: BottomNavigationBar(
showSelectedLabels: false, // <-- HERE
showUnselectedLabels: false, // <-- AND HERE
items: [
BottomNavigationBarItem(
icon: Icon(Icons.person),
title: Text('Personal')
),
BottomNavigationBarItem(
icon: Icon(Icons.notifications),
title: Text('Notifications'),
),
]
...
)
Run Code Online (Sandbox Code Playgroud)
...导致:
Dan*_*lev 18
由于此功能尚未实现,因此有两种解决方法。
Container(height: 0.0)而不是Text("") 更新:
只需将其添加到您的BottomNavigationBar
showSelectedLabels: false,
showUnselectedLabels: false,
Run Code Online (Sandbox Code Playgroud)
Soo*_*rya 10
在新版本的flutter中,title被贬值了,我们必须提供label。因此,将标签设置为空字符串
BottomNavigationBarItem(
label: '',
icon: Icon(
Icons.home_rounded,
color: kHintColor,
size: 35,
),
activeIcon: Icon(
Icons.home_rounded,
color: kMainColor,
size: 35,
),
),
Run Code Online (Sandbox Code Playgroud)
并将以下内容添加到 BottomNavigationBar:
selectedLabelStyle: TextStyle(fontSize: 0),
unselectedLabelStyle: TextStyle(fontSize: 0),
Run Code Online (Sandbox Code Playgroud)
希望该代码段对某人有所帮助。对我来说效果很好。
bottomNavigationBar : new BottomNavigationBar(
items: [
BottomNavigationBarItem(
icon: Icons.search,
title: Padding(padding: EdgeInsets.all(0))
),
BottomNavigationBarItem(
icon: Icons.share,
title: Padding(padding: EdgeInsets.all(0))
),
BottomNavigationBarItem(
icon: Icons.call,
title: Padding(padding: EdgeInsets.all(0))
)],
type: BottomNavigationBarType.fixed
)
//bottomNavBar
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5295 次 |
| 最近记录: |