gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-03 02:55:54 25 4
gpt4 key购买 nike

我的 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 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.

关于flutter - 底部导航栏全白,如何解决?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58839930/

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