我不熟悉,尝试添加四个图标时创建了底部导航栏。图标颜色变为白色。任何人都可以建议我如何实现这一目标。下面是我的代码。任何帮助将不胜感激。
bottomNavigationBar: new BottomNavigationBar(items: [
new BottomNavigationBarItem(icon: new Icon(Icons.add), title: new Text("Text")),
new BottomNavigationBarItem(icon: new Icon(Icons.person), title: new Text("Contact")),
new BottomNavigationBarItem(icon: new Icon(Icons.accessibility), title: new Text("Acess")),
new BottomNavigationBarItem(icon: new Icon(Icons.account_balance), title: new Text("Balance"))
]),
Run Code Online (Sandbox Code Playgroud)
如果元素多于3个,则需要显式设置 type: BottomNavigationBarType.fixed,
bottomNavigationBar: new BottomNavigationBar(
type: BottomNavigationBarType.fixed,
items: [
new BottomNavigationBarItem(icon: new Icon(Icons.add), title: new Text("Text")),
new BottomNavigationBarItem(icon: new Icon(Icons.person), title: new Text("Contact")),
new BottomNavigationBarItem(icon: new Icon(Icons.accessibility), title: new Text("Acess")),
new BottomNavigationBarItem(icon: new Icon(Icons.account_balance), title: new Text("Balance"))
]),
Run Code Online (Sandbox Code Playgroud)
如果提供了3个以上的BottomNavigationBar项目,则类型(如果未指定)将根据https://docs.flutter.io/flutter/material/BottomNavigationBar/BottomNavigationBar.html更改为BottomNavigationBarType.shifting 。
| 归档时间: |
|
| 查看次数: |
324 次 |
| 最近记录: |