I designed a simple svg
into this website and i'll to try programing that in flutter
I have implemented the code using this approach:
class AppbarBackgroundPainter extends CustomPainter {
final Color color;
AppbarBackgroundPainter(this.color);
@override
void paint(Canvas canvas, Size size) {
final Paint paint = Paint()
..color = color
..style = PaintingStyle.fill;
/*Path path = Path()
..moveTo(1, 50)
..moveTo(0, 33)
..lineTo(0, 41)
..quadraticBezierTo(0, 40, 1, 40)
..lineTo(24, 40)
..cubicTo(27, 40, 27, 40, 29, 36)
..quadraticBezierTo(30, 34, 32, 34)
..lineTo(54, 34)
..lineTo(54, 33)
..lineTo(0, 33);*/
/* converted SVG to dart*/
Path path_0 = Path();
path_0.moveTo(0, size.height);
path_0.lineTo(0, size.height);
path_0.cubicTo(
0,
size.height * 0.9207522,
size.width * 0.006172833,
size.height * 0.8837156,
size.width * 0.01851852,
size.height * 0.8837156);
path_0.lineTo(size.width * 0.4444444, size.height * 0.8837156);
path_0.cubicTo(
size.width * 0.5000000,
size.height * 0.8837156,
size.width * 0.5000000,
size.height * 0.8837156,
size.width * 0.5370370,
size.height * 0.4392711);
path_0.cubicTo(
size.width * 0.5493833,
size.height * 0.2911222,
size.width * 0.5679019,
size.height * 0.2170489,
size.width * 0.5925926,
size.height * 0.2170489);
path_0.lineTo(size.width, size.height * 0.2170489);
path_0.lineTo(size.width, 0);
path_0.lineTo(0, 0);
path_0.close();
Paint paint_0_fill = Paint()..style = PaintingStyle.fill;
paint_0_fill.color = color;
canvas.drawPath(path_0, paint_0_fill);
canvas.drawPath(path, paint);
}
@override
bool shouldRepaint(CustomPainter oldDelegate) {
return true;
}
}
However, I was unable to apply the things shown in the picture to the code. it should be used on appbar
background