从Flutter移除底部导航栏上的默认填充或边距 [英] Remove default padding or margin on Bottom Navigation Bar from Flutter
本文介绍了从Flutter移除底部导航栏上的默认填充或边距的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是问题的图片,它是底部导航栏上的默认填充吗?如果是,该如何删除?
This is the picture of the problem, is it a default padding on Bottom Navigation Bar? If it is, how can I remove it?
如下面的代码所示,我在BottomNavigationBarItem的内部有一个容器和一个图标,但是图标和栏之间有一个空格.
As you can see in the code below, I have a container and a icon inside of the BottomNavigationBarItem, but there is a space between the icon and the bar.
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)),
),
推荐答案
该空间由 BottomNavigationBarItem
文本保留,因此您必须在中将
. selectedFontSize
设置为0> BottomNavigationBar
That space is reserved by the BottomNavigationBarItem
text so you must set selectedFontSize
to 0 in the BottomNavigationBar
.
这篇关于从Flutter移除底部导航栏上的默认填充或边距的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文