Flutter圆角底部导航栏

5

我在 ClipRRect 中放置了一个底部导航栏(用于实现圆角)。它的角是圆的,但没有透明的角。我分享了一张图片以展示问题。如何实现透明的圆角?

代码:

bottomNavigationBar: ClipRRect(
        borderRadius: BorderRadius.only(
          topLeft: Radius.circular(30.0),
          topRight: Radius.circular(30.0),
        ),
        child: BottomNavigationBar(
          currentIndex: _selectedIndex,
          selectedItemColor: Colors.amber[800],
          onTap: _onItemTapped,
          items: <BottomNavigationBarItem>[
            BottomNavigationBarItem(
              icon: Icon(Icons.home),
              label: 'Home',
            ),
            BottomNavigationBarItem(
              icon: Icon(Icons.search),
              label: 'Search',
            ),
            BottomNavigationBarItem(
              icon: Icon(Icons.person),
              label: 'Profile',
            ),
          ],
        ),
      ),

enter image description here

2个回答

8

请参考我的答案,extendBody

Scaffold(
  extendBody: true,

1

在你的主题中尝试这个

theme: ThemeData(
    canvasColor: Colors.transparent,)

谢谢,我也尝试过了,但是脚手架或其他小部件没有“主题”字段。 - gurkan
它在你的材料应用程序中。 - Ardeshir ojan

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接