首页
学习
活动
专区
圈层
工具
发布
社区首页 >专栏 >Flutter BottomNavigationBar不显示(显示白色)?

Flutter BottomNavigationBar不显示(显示白色)?

作者头像
yechaoa
发布于 2022-06-10 13:50:31
发布于 2022-06-10 13:50:31
1.3K0
举报
文章被收录于专栏:移动开发专栏移动开发专栏

BottomNavigationBar 超过3个之后不显示(显示白色)?

官网文档解释:

The bottom navigation bar’s type changes how its items are displayed. If not specified it’s automatically set to BottomNavigationBarType.fixed when there are less than four items, BottomNavigationBarType.shifting otherwise.

  • BottomNavigationBarType.fixed, the default when there are less than four items. The selected item is rendered with fixedColor if it’s non-null, otherwise the theme’s ThemeData.primaryColor is used. The navigation bar’s background color is the default Material background color, ThemeData.canvasColor (essentially opaque white).
  • BottomNavigationBarType.shifting, the default when there are four or more items. All items are rendered in white and 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.

解决办法:

加一个type属性:

代码语言:javascript
复制
type: BottomNavigationBarType.fixed,
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2019-05-05,如有侵权请联系 cloudcommunity@tencent.com 删除
目录
  • 解决办法:
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档