gpt4 book ai didi

flutter - 如何在 Flutter 的 BottomNavigationBarItem 中更改标签的颜色?

转载 作者:行者123 更新时间:2023-12-02 16:02:38 28 4
gpt4 key购买 nike

我在我的应用程序菜单中放置了一些底部导航栏项目,我希望它们有一些标签。我贴上了标签,但我真的不知道如何更改它们的基色。就像我希望它们都是白色的。

这是其中一个的代码:

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')
],
)

它现在的样子,供引用:

BottomNavigationBarItems

最佳答案

您必须更改 BottomNavigationBar 中的 unselectedItemColor 属性。

bottomNavigationBar: BottomNavigationBar(
unselectedLabelStyle: const TextStyle(color: Colors.white, fontSize: 14),
backgroundColor: const Color(0xFF084A76),
fixedColor: Colors.white,
unselectedItemColor: Colors.white, //<-- add this
...

更多详情:BottomNavigationBar

关于flutter - 如何在 Flutter 的 BottomNavigationBarItem 中更改标签的颜色?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70229321/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com