dart 更改底部导航栏颜色抖动

bfhwhh0e  于 2023-02-27  发布在  其他
关注(0)|答案(1)|浏览(178)

我有一个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,
      ),
mspsb9vt

mspsb9vt1#

type设置为BottomNavigationBarType.shifting时,BottomNavigationBarbackgroundcolor变量似乎被忽略。
将其更改为BottomNavigationBarType.fixed使我能够相应地设置背景颜色。

相关问题