flutter:如何翻转这个路径剪辑Bezier



我有这个形状在此处输入图像描述

我想把它翻转成这个

在此处输入图像描述

这是的原始代码

class CustomMenuClipper extends CustomClipper<Path> {
@override
Path getClip(Size size) {
Paint paint = Paint();
paint.color = Colors.white;
final width = size.width;
final height = size.height;
Path path = Path();
path.moveTo(0, 0);
path.quadraticBezierTo(0, 8, 10, 16);
path.quadraticBezierTo(width - 1, height / 2 - 20, width, height / 2);
path.quadraticBezierTo(width + 1, height / 2 + 20, 10, height - 16);
path.quadraticBezierTo(0, height - 8, 0, height);
path.close();
return path;
}
@override
bool shouldReclip(CustomClipper<Path> oldClipper) {
return true;
}
} 

这是github存储库我不介意它变成半个圆圈。

我认为应该是这样的:

Path getClip(Size size) {
Paint paint = Paint();
paint.color = Colors.white;

final width = size.width;
final height = size.height;

Path path = Path();
path.moveTo(width, 0);
path.quadraticBezierTo(16, 10, 8, 0);
path.quadraticBezierTo(height / 2,  width, height / 2 - 20 ,width - 1);
path.quadraticBezierTo( height - 16, 10, height / 2 + 20, height - 16width + 1);
path.quadraticBezierTo(height, 0, height - 8, 0);
path.close();
return path;
}

我不建议这样做,因为不同的设备可能会再现不同的行为。也许使用CCD_ 1和CCD_。

最新更新