底部导航栏全白,如何解决?

Bottom Navigation Bar is completely white, how to fix?

我的BottomNavigationBar全白了。当有 3 个图标时它工作正常,但当增加到 4 时,导航栏变成全白。仍然可以选择和更改选项卡。

这是小部件 运行 时控制台的输出。

ic=null mNaviBarColor -15724014 mIsGetNaviBarColorSuccess true , NavVisible : true , NavTrans : false

这是导航栏的构建:

_bottomNavChildren[_currentIndex],
  bottomNavigationBar: BottomNavigationBar(
    onTap: onTabTapped,
    currentIndex: _currentIndex,
    items: [
      BottomNavigationBarItem(
        icon: Icon(Icons.search),
        title: Text('Browse'),
      ),
      BottomNavigationBarItem(
        icon: Icon(Icons.message),
        title: Text('Messages'),
      ),
      BottomNavigationBarItem(
        icon: Icon(Icons.person_outline),
        title: Text('Profile'),

这是指向相关索引 类 的 List 小部件。

  int _currentIndex = 0;
  final List<Widget> _bottomNavChildren = [
    BrowsePage(),
    MessagesPage(),
    ProfilePage(),
  ];

有人知道问题出在哪里吗? 谢谢

来自飘飘official documentation:

BottomNavigationBarType.fixed, the default when there are less than four items. The selected item is rendered with the selectedItemColor if it's non-null, otherwise the theme's ThemeData.primaryColor is used. If backgroundColor is null, The navigation bar's background color defaults to the Material background color, ThemeData.canvasColor (essentially opaque white).

BottomNavigationBarType.shifting, the default when there are four or more items. If selectedItemColor is null, all items are rendered in white. The navigation bar's background color is the same as the BottomNavigationBarItem.backgroundColor of the selected item. In this case it's assumed that each item will have a different background color and that background color will contrast well with white.