如何在Flutter中向ClipOval添加阴影? [英] How to add shadow to ClipOval in flutter?

查看:594
本文介绍了如何在Flutter中向ClipOval添加阴影?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在努力使新应用成为初学者.因此,在事物上添加阴影对我来说是全新的.

I have been trying to make a new app being a beginner. So, adding shadows to things is completely new to me.

所以,以下是我的代码:

So, Following is my code:

Container(
          child: Row(
            mainAxisAlignment: MainAxisAlignment.start,
            children: <Widget>[
              ClipOval(
                child: Material(
                  color: Colors.white, // button color
                  child: InkWell(
                    // splashColor: Colors.red, // inkwell color
                    child: SizedBox(
                        width: 46, height: 46, child: Icon(Icons.menu,color: Colors.red,),),
                    onTap: () {},
                  ),
                ),
              ),

            ],
          ),
        ),

以下是模拟:

推荐答案

您可以创建自己的然后使用它

ClipOvalShadow(
  shadow: Shadow(
    color: Colors.amber,
    offset: Offset(1.0, 1.0),
    blurRadius: 2,
  ),
  clipper: CustomClipperOval(),
  child: ClipOval(
    child: Material(
      color: Colors.white, // button color
      child: InkWell(
        // splashColor: Colors.red, // inkwell color
        child: Container(
          width: 46,
          height: 46,
          child: Icon(
            Icons.menu,
            color: Colors.black,
          ),
        ),
        onTap: () {},
      ),
    ),
  ),
),

结果将是

这篇关于如何在Flutter中向ClipOval添加阴影?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆