Created
June 10, 2021 17:00
-
-
Save AndresR173/7b3aced8fc68a0fc78fcd910a85f22d2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
class CurvePainter extends CustomPainter { | |
final Color paintColor; | |
CurvePainter(this.paintColor); | |
@override | |
void paint(Canvas canvas, Size size) { | |
final paint = Paint(); | |
paint.color = paintColor; | |
paint.style = PaintingStyle.fill; | |
final path = Path(); | |
path.moveTo(0, -1); | |
path.lineTo(0, size.height * 0.3); | |
path.quadraticBezierTo( | |
size.width * 0.1, | |
size.height, | |
size.width * 0.4, | |
size.height * 0.7, | |
); | |
path.quadraticBezierTo( | |
size.width * 0.8, | |
size.height * 0.1, | |
size.width, | |
size.height * 0.91, | |
); | |
path.lineTo(size.width, 0); | |
canvas.drawPath(path, paint); | |
} | |
@override | |
bool shouldRepaint(CustomPainter oldDelegate) { | |
return true; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment