我正在尝试自定义 bottomNavigationBar。我的意图是删除标签占用空间,包括边距和填充。我想将内容水平和垂直居中到这个空间。
我的代码:
bottomNavigationBar: Container(
child: ClipRRect(
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(30.0),
bottomRight: Radius.circular(30.0),
),
child: BottomNavigationBar(
items: const <BottomNavigationBarItem>[
BottomNavigationBarItem(
icon: Icon(
Icons.pause,
color: Colors.white,
size: 40,
),
label: '',
),
BottomNavigationBarItem(
icon: Text(
"Imagine . Ariana Grande",
style: TextStyle(
color: Colors.white,
fontSize: 13,
fontWeight: FontWeight.w400,
),
),
label: '',
),
BottomNavigationBarItem(
icon: Icon(
Icons.arrow_circle_up,
color: Colors.white,
size: 35,
),
label: '',
),
],
//currentIndex: ,
selectedItemColor: Colors.white,
//onTap: ,
backgroundColor: Colors.blue,
),
结果:
我想要这个:
最佳答案
可以通过BottomNavigationBar中的一个属性selectedFontSize: 0
关于flutter - 如何在 Flutter 中将标签空间禁用到 bottomNavigationBar,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66936045/