底部导航栏是完全白色的,如何解决?

问题描述 投票:0回答:1

我的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(),
  ];

谁知道这是什么问题吗?谢谢

flutter dart navigationbar
1个回答
0
投票

从颤动official documentation

BottomNavigationBarType.fixed,当小于四个项目。所选项目使用selectedItemColor呈现如果为非null,则主题的ThemeData.primaryColor为用过的。如果backgroundColor为null,则导航栏的背景颜色默认为“材质”背景颜色ThemeData.canvasColor(基本上是不透明的白色)。

BottomNavigationBarType.shifting,当有四个或更多项目。如果selectedItemColor为null,则所有项目均以白色。导航栏的背景颜色与所选项目的BottomNavigationBarItem.backgroundColor。在这假设每个项目都有不同的背景颜色,并且背景颜色将与白色形成很好的对比。

© www.soinside.com 2019 - 2024. All rights reserved.