从 Flutter 中删除底部导航栏上的默认填充或边距

Gab*_*ito 5 dart flutter flutter-layout

在此处输入图片说明

这是问题的图片,它是底部导航栏上的默认填充吗?如果是,我该如何删除它?

正如您在下面的代码中看到的,我在 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)),
            ),
Run Code Online (Sandbox Code Playgroud)

Und*_*ore 10

该空间由BottomNavigationBarItem文本保留,因此您必须selectedFontSizeBottomNavigationBar.