This below code can create a custome path
and i it doesn’t have curves on topLeft
and topRight
, could you please help me how can i do that?
i need to make the same as this screen shot:
original:
class CurvedPainter extends CustomPainter {
@override
void paint(Canvas canvas, Size size) {
final paint = Paint()
..color = DV.$light
..style = PaintingStyle.fill;
final path = Path()
..moveTo(0, size.height * 0.7)
..quadraticBezierTo(size.width * 0.25, size.height * 0.8, size.width * 0.4, size.height * 0.6)
..quadraticBezierTo(size.width * 0.65, size.height * 0.3, size.width, size.height * 0.6)
..lineTo(size.width, 0)
..lineTo(0, 0);
canvas.drawPath(path, paint);
}
@override
bool shouldRepaint(CustomPainter oldDelegate) {
return false;
}
}
2
Answers
To create a custom path with straight lines on the topLeft and topRight corners instead of curves, you can modify the path you’ve defined in your CurvedPainter class.
To add rounded corners to top right and top left, I recommend you using arcToPoint:
Here is how you could use it: