首页 > 解决方案 > 如何在不影响后台内容的情况下弯曲底部导航栏角?扑

问题描述

我创建了一个带有颤振的自定义底部导航栏。但我仍然可以看到白色填充了弯角后面的背景。我想看看背景内容。

这就是底部导航栏的样子。

在此处输入图像描述

如您所见,角落充满了白色。

这是我的底部导航栏代码。

bottomNavigationBar: Container(
      decoration: BoxDecoration(
        color: Colors.transparent,
        backgroundBlendMode: BlendMode.clear,
        borderRadius: BorderRadius.only(
          topLeft: Radius.circular(18),
          topRight: Radius.circular(18),
        ),
        boxShadow: [
          BoxShadow(color: Colors.black38, spreadRadius: 0, blurRadius: 10),
        ],
      ),
      height: MediaQuery.of(context).size.height * 0.085,
      child: ClipRRect(
        borderRadius: BorderRadius.only(
          topLeft: Radius.circular(18.0),
          topRight: Radius.circular(18.0),
        ),
        child: BottomNavigationBar(
          backgroundColor: Color(0xFFF0B50F),
          type: BottomNavigationBarType.fixed,
          selectedLabelStyle: TextStyle(fontSize: 12),
          items: [
            BottomNavigationBarItem(),
            BottomNavigationBarItem(),
            BottomNavigationBarItem(),
            BottomNavigationBarItem(),
            BottomNavigationBarItem(),
          ],
          currentIndex: _selectedPage,
          selectedItemColor: Colors.black,
          onTap: _onItemTapped,
        ),
      ),
    ),

我尝试将容器的颜色设置为透明。但它没有用。

标签: flutterdartflutter-bottomnavigation

解决方案


试试这个:

Scaffold(
    extendBody: true,

推荐阅读