首页 > 解决方案 > 自定义 ClipPath 帮助 Flutter

问题描述

请帮我建立以下形状。

在此处输入图像描述

我编写了以下代码。

class CustomShapeBar extends CustomClipper<Path> {
  @override
  Path getClip(Size size) {
    var path = Path();
    double height = size.height;
    double width = size.width;
    path.lineTo(0, height - 230);
    path.quadraticBezierTo(width / 2, height, width, height - 230);
    path.lineTo(width, 0);
    path.close();
    return path;
  }

  @override
  bool shouldReclip(CustomClipper<Path> oldClipper) {
    return true;
  }
}

这就是我所取得的成就:

在此处输入图像描述

标签: flutter

解决方案


推荐阅读