[英]Custom Clipper Bezier curve Flutter
I am currently unable to draw a bezier curve.我目前无法绘制贝塞尔曲线。
The output I have right now is :我现在的输出是:
The output that I need is :我需要的输出是:
What should I add here as bezier values to get the curve?我应该在这里添加什么作为贝塞尔值来获得曲线? The code snippet of the custom clipper is:
自定义裁剪器的代码片段是:
class OnBoardingClipper extends CustomClipper<Path> {
@override
Path getClip(Size size) {
var path = Path();
path.moveTo(0.0, size.height * 0.18);
path.lineTo(0.0, size.height);
path.lineTo(size.width, size.height);
path.lineTo(size.width, 0.0);
return path;
}
@override
bool shouldReclip(CustomClipper<Path> oldClipper) => false;
}
PS Thanks for reading and apologies in case of bad formatting. PS 感谢您的阅读并在格式错误的情况下道歉。 :-)
:-)
You can add a quadraticBezier
with values of eg, (3 / 4 * size.width, size.height * 0.18)
, (size.width, size.height * 0.05)
.您可以添加一个
quadraticBezier
,其值为(3 / 4 * size.width, size.height * 0.18)
, (size.width, size.height * 0.05)
。
Code:代码:
@override
Path getClip(Size size) {
var path = Path();
path.moveTo(0.0, size.height * 0.18);
path.quadraticBezierTo(
3 / 4 * size.width, size.height * 0.18, size.width, size.height * 0.05);
path.lineTo(size.width, size.height);
path.lineTo(0.0, size.height);
return path;
}
Result:结果:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.