Flutter CustomClipper 三角形
Flutter CustomClipper Triangle
我有这个三角形
我希望它的形状像这样
有人可以帮助我吗?
这是我的实际代码
class TriangleClipperr extends CustomClipper<Path> {
@override
Path getClip(Size size) {
final path = Path();
path.lineTo(size.width, 0.0);
path.lineTo(size.width / 2, size.height);
path.close();
return path;
}
@override
bool shouldReclip(TriangleClipperr oldClipper) => false;
}
首先需要将当前点移动到中间,然后绘制休息路径。
class TriangleClipperr extends CustomClipper<Path> {
@override
Path getClip(Size size) {
final path = Path();
path.moveTo(size.width / 2, 0);
path.lineTo(size.width, size.height);
path.lineTo(0, size.height);
path.close();
return path;
}
@override
bool shouldReclip(TriangleClipperr oldClipper) => false;
}
我有这个三角形
有人可以帮助我吗? 这是我的实际代码
class TriangleClipperr extends CustomClipper<Path> {
@override
Path getClip(Size size) {
final path = Path();
path.lineTo(size.width, 0.0);
path.lineTo(size.width / 2, size.height);
path.close();
return path;
}
@override
bool shouldReclip(TriangleClipperr oldClipper) => false;
}
首先需要将当前点移动到中间,然后绘制休息路径。
class TriangleClipperr extends CustomClipper<Path> {
@override
Path getClip(Size size) {
final path = Path();
path.moveTo(size.width / 2, 0);
path.lineTo(size.width, size.height);
path.lineTo(0, size.height);
path.close();
return path;
}
@override
bool shouldReclip(TriangleClipperr oldClipper) => false;
}