减少底部导航栏中的顶部和底部填充



我想减少BottomNavigationBar的顶部和底部填充,但我想保持相同的图标高度和条形图高度为50像素:

bottomNavigationBar: SizedBox(
height: 50,
child: BottomNavigationBar(
showSelectedLabels: false,
showUnselectedLabels: false,
type: BottomNavigationBarType.fixed,
elevation: 5.0,
currentIndex: 0,
items: buildBottomBarItems(),
),
)

构建底部条形项目的方法:

List<BottomNavigationBarItem> buildBottomBarItems() {
List<BottomNavigationBarItem> _bottomBarItems = List();
List<String> _iconNames = ["home", "search", "plus", "heart"];
for (var i = 0; i < _iconNames.length; ++i) {
_bottomBarItems.add(
BottomNavigationBarItem(
icon: Container(
child: new Image.asset('assets/' + _iconNames[i] + '.png', width: 24, height: 24)
),
title: Text('')
)
);
}
}

(在当前情况下,存在4.0像素的溢出(。谢谢

要删除BottomNavigationBar中的默认空格,请将selectedFontSize设置为0。它将删除可用于文本的默认空间。底部导航栏(selectedFontSize:0.0,)

最新更新