我有一个flutter网站底部的导航栏,但是栏是白色的白色文本。我不知道如何修复它,使图标和文本可以看到。我试图设置背景色,但它一直无视我,并设置为白色。
下面是该屏幕的代码:
bottomNavigationBar: BottomNavigationBar(
type: BottomNavigationBarType.shifting,
items: const <BottomNavigationBarItem>[
BottomNavigationBarItem(
icon: Icon(Icons.edit_note_sharp),
label: 'txt1',
),
BottomNavigationBarItem(
icon: Icon(Icons.checklist_outlined),
label: 'txt2',
),
],
currentIndex: _selectedIndex,
onTap: onItemTapped,
backgroundColor: kPrimaryColor,
mouseCursor: SystemMouseCursors.click,
selectedFontSize: 20,
selectedIconTheme: const IconThemeData(color: Colors.amberAccent, size: 40),
selectedItemColor: Colors.amberAccent,
selectedLabelStyle: const TextStyle(fontWeight: FontWeight.bold, color: Colors.black),
unselectedIconTheme: const IconThemeData(
color: kPrimaryLightColor,
),
unselectedItemColor: Colors.blueGrey,
),
1条答案
按热度按时间mspsb9vt1#
当
type
设置为BottomNavigationBarType.shifting
时,BottomNavigationBar
的backgroundcolor
变量似乎被忽略。将其更改为
BottomNavigationBarType.fixed
使我能够相应地设置背景颜色。