【发布时间】:2020-06-30 20:40:26
【问题描述】:
这是问题的图片,它是底部导航栏上的默认填充吗?如果是,我该如何删除它?
正如您在下面的代码中看到的,我在 BottomNavigationBarItem 内有一个容器和一个图标,但图标和栏之间有一个空格。
return Scaffold(
bottomNavigationBar: BottomNavigationBar(
backgroundColor: Color.fromARGB(255, 18, 124, 157),
items: <BottomNavigationBarItem>[
BottomNavigationBarItem(
activeIcon: Container(
margin: EdgeInsets.all(0),
padding: EdgeInsets.all(0),
height: 50,
width: 300,
color: Color.fromARGB(255, 18, 124, 157),
child: Icon(Icons.home, size: 40, color: Colors.white),
),
icon: Container(
margin: EdgeInsets.all(0),
padding: EdgeInsets.all(0),
height: 50,
width: 300,
color: Colors.white,
child: Icon(Icons.home,
size: 40, color: Color.fromRGBO(114, 114, 114, 1)),
),
【问题讨论】:
-
这既不是填充也不是边距,您可以使用
activeIcon中的高度和宽度属性来控制它 -
Noppp,当我增加高度时,边距或填充仍然存在。
-
好的,我刚刚找到了一种方法,我正在使用小部件 BottomAppBar 并在其中使用 MaterialButtons,就像在这个 repo 中一样:github.com/mahtab-ali/Flutter-Bottom-Tab-Bar
标签: flutter dart flutter-layout