Flutter 底部导航栏超过3个不能正常显示

2019-02-25  本文已影响0人  Free_0221

初玩Flutter的人都会遇到,底部导航大于等于4个的时候如下图片:

我们可以看到图标,但是是模糊的,不清楚。

通过阅读类BottomNavigationBar类,可以发现:

1、BottomNavigationBarItem (assert(item.leng>=2))最少要有两个导航按钮,

2、BottomNavigationBarType中加了

type = type ?? (items.length <= 3 ? BottomNavigationBarType.fixed : BottomNavigationBarType.shifting),

在我们实现的时候小于等于3个的时候显示是正常的,而大于3个或以上的时候,则显示模糊,此时我只需要重载

BottomNavigationBarType的属性值,继续 默认为fixed;效果如下

上一篇 下一篇

猜你喜欢

热点阅读