消除底部导航栏抖动中的底部阴影效果

时间:2020-07-27 07:15:04

标签: flutter dart

enter image description here

如上图所示,iPhone 11的底部导航栏具有底部阴影,有什么方法可以去除阴影?

floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
    bottomNavigationBar: BottomAppBar(
      clipBehavior: Clip.antiAliasWithSaveLayer,
      shape: CircularNotchedRectangle(),
      child: Theme(
        data: Theme.of(buildContext)
            .copyWith(canvasColor: Colors.white, primaryColor: Colors.grey),
        child: BottomNavigationBar(
          onTap: (index){
            
          },
          type: BottomNavigationBarType.fixed,
          items: bottomNavigationBar.map((element) {
            return BottomNavigationBarItem(
                icon: Icon(element["icon"]), title: Text(element["title"]));
          }).toList(),
        ),
      ),
    ));

enter image description here

编辑:这是设置高程:0后得到的结果

enter image description here

编辑:添加了safearea bottomAppBar阴影问题后,但是可以保留以前使用过的statusBarColor(陷波区域)吗?

1 个答案:

答案 0 :(得分:1)

在您的BottomNavigationBar 内放置elevation: 0.0 示例:

child: BottomNavigationBar(
        type: BottomNavigationBarType.fixed,
        backgroundColor: Theme.of(context).primaryColor,
        elevation: 0.0,

BottomNavigationBar