[英]How do i change the label's color in a BottomNavigationBarItem in Flutter?
I'm putting some bottom navigation bar items in my app's menu and I want them to have some labels.我在我的应用程序菜单中放置了一些底部导航栏项目,我希望它们有一些标签。 I put the labels but I don't really know how to change their base color.
我放了标签,但我真的不知道如何更改它们的基色。 Like I want all of them to be white.
就像我希望他们都是白色的。
Here's the code for one of them:这是其中之一的代码:
bottomNavigationBar: BottomNavigationBar(
unselectedLabelStyle: const TextStyle(color: Colors.white, fontSize: 14),
backgroundColor: const Color(0xFF084A76),
fixedColor: Colors.white,
items: [
BottomNavigationBarItem(
icon: InkWell(
onTap: () async {
//Borramos un lote
deleteLote();
},
child: Container(
height: 47,
width: 50,
decoration: const BoxDecoration(
shape: BoxShape.circle, color: Colors.black38),
child: const Icon(
Icons.delete,
size: 32,
color: Colors.white,
),
),
),
label: 'Borrar Lote'),
BottomNavigationBarItem(
icon: InkWell(
onTap: () async {
//Añadimos un lote
addLote();
},
child: Container(
height: 47,
width: 50,
decoration: const BoxDecoration(
shape: BoxShape.circle, color: Colors.black38),
child: const Icon(
Icons.add,
size: 32,
color: Colors.white,
),
),
),
label: 'Añadir Lote')
],
)
Image of how it's looking right now, for reference:它现在看起来如何的图像,以供参考:
You have to change unselectedItemColor
property in your BottomNavigationBar
.您必须更改
BottomNavigationBar
中的unselectedItemColor
属性。
More details: BottomNavigationBar更多细节: 底部导航栏
Instead use:而是使用:
unselectedLabelStyle: const TextStyle(color: Colors.white, fontSize: 14),
you can try:你可以试试:
unselectedItemColor: Colors.white,
unselectedFontSize: 14,
in your BottomNavigationBar在您的底部导航栏中
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.