使BottomNavigationItem图标填充高度

时间:2018-07-23 00:13:23

标签: dart flutter

这是我的BottomNavigationBar的图像。

enter image description here

图标下方有空白。 如何删除空白并让图标填充空白?我尝试将空的Container传递给title属性,但是空间仍然存在。

这是我的BottomNavigationBar代码:

new BottomNavigationBar(
            items: [
              new BottomNavigationBarItem(
                  icon: new Icon(Icons.home, color: Colors.grey),
                  title: new Container(),
                  backgroundColor: Colors.white),
              new BottomNavigationBarItem(
                  icon: new Icon(Icons.search, color: Colors.grey),
                  title: new Container(),
                  backgroundColor: Colors.white),
              new BottomNavigationBarItem(
                  icon: new Icon(Icons.add_circle, color: Colors.grey),
                  title: new Container(),
                  backgroundColor: Colors.white),
              new BottomNavigationBarItem(
                  icon: new Icon(Icons.star, color: Colors.grey),
                  title: new Container(),
                  backgroundColor: Colors.white),
              new BottomNavigationBarItem(
                  icon: new Icon(Icons.person_outline, color: Colors.grey),
                  title: new Container(),
                  backgroundColor: Colors.white),
            ])

1 个答案:

答案 0 :(得分:0)

尝试以下操作

bottomNavigationBar: BottomAppBar(
child: new Row(
  mainAxisSize: MainAxisSize.max,
  mainAxisAlignment: MainAxisAlignment.spaceEvenly,
  children: <Widget>[
    IconButton(icon: Icon(Icons.menu), onPressed: () {//code here},),
    IconButton(icon: Icon(Icons.search), onPressed: () {//code here},),
    IconButton(icon: Icon(Icons.search), onPressed: () {//code here},),
    IconButton(icon: Icon(Icons.search), onPressed: () {//code here},),
  ],
),
),