user-interface - 如何在 flutter 的标签栏后面添加阴影?

标签 user-interface flutter dart user-experience

我想在包装在容器中的此选项卡栏后面添加一个微妙的阴影。我试图添加它,但是它没有明显显示出来。 enter image description here
我必须以这种方式进行编辑,因为我必须将条形的边缘裁剪为使其变圆。

Widget _bottomNavigationBar(int selectedIndex) => ClipRRect(
    borderRadius: BorderRadius.only(
        topLeft: Radius.circular(52.0), topRight: Radius.circular(52.0)),
    child: Container(
        height: 90,
        decoration: BoxDecoration(
          borderRadius: const BorderRadius.only(
              topLeft: Radius.circular(82.0),
              topRight: Radius.circular(52.0)),
          boxShadow: <BoxShadow>[
            BoxShadow(
              color: Colors.black,
              offset: Offset(-5, 5),
              blurRadius: 10,
            ),
          ],
        ),
        child: ClipRRect(
          borderRadius: BorderRadius.only(
              topLeft: Radius.circular(52.0),
              topRight: Radius.circular(52.0)),
          child: BottomNavigationBar(
            selectedItemColor: Color(0xFFFE524B),
            unselectedItemColor: Color(0xFFFF8C3B),
            onTap: (int index) => setState(() => _selectedIndex = index),
            currentIndex: selectedIndex,
            items: const <BottomNavigationBarItem>[
              BottomNavigationBarItem(
                  icon: Icon(
                    Entypo.home,
                    size: 28,
                  ),
                  title: Text('')),
              BottomNavigationBarItem(
                  icon: Icon(
                    Entypo.game_controller,
                    size: 28,
                  ),
                  title: Text('')),
              BottomNavigationBarItem(
                  icon: Icon(
                    Entypo.wallet,
                    size: 28,
                  ),
                  title: Text('')),
            ],
          ),
        )),
  );

我希望我的标签栏看起来像这样
enter image description here

最佳答案

在这里,CLipRRect窗口小部件将您的窗口小部件切成矩形。
您的框阴影由于剪辑r rect被切断

删除剪辑小部件,然后尝试

关于user-interface - 如何在 flutter 的标签栏后面添加阴影?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59597629/

相关文章:

java - 包装 UI 组件的模式

Flutter:在 2 个 LinearGradients 之间淡入淡出

Flutter 实现暂停和播放...... 流媒体音乐

flutter - 我如何在我的 API 请求类(无小部件类)中访问 bloc

android:scrollHorizo​​ntally 不适用于 Samsung Galaxy Nexus

android - Facebook SDK v4 LoginButton 忽略 XML 自定义

dart - 安全访问列表索引的方法

dart - 在 View 底部显示警报对话框

c++ - Qt QStatusBar 更宽的分隔符

flutter - 通过网络加载 Flutter/Dart 代码