小编Vij*_* PD的帖子

将阴影添加到从容器创建的 ClipPath - Flutter

我想向从容器创建的 ClipPath 添加阴影。这是我创建的 ClipPath:

              ClipPath(
                clipper: RibbonClipper(),
                child: Container(
                  height: 20,
                  width: 80,
                  decoration: BoxDecoration(
                    borderRadius: BorderRadius.only(
                      topLeft: Radius.circular(5.0),
                      bottomLeft: Radius.circular(5.0),
                    ),
                    color: Color(0xFF338D5E),
                  ),
                ),
              ), 
Run Code Online (Sandbox Code Playgroud)

CustomClipper 路径是:

  @override
  Path getClip(Size size) {
    var path = Path();
    path.lineTo(0, size.height);
    path.lineTo(size.width, size.height);
    path.lineTo(size.width * .90, size.height * .5);
    path.lineTo(size.width, 0);
    return path;
  }

  @override
  bool shouldReclip(CustomClipper<Path> oldClipper) {
    return true;
  }
}
Run Code Online (Sandbox Code Playgroud)

shadow clip-path flutter flutter-layout flutter-widget

1
推荐指数
1
解决办法
3473
查看次数