Created
October 28, 2020 18:09
-
-
Save prasadsunny1/0168b56e25c6d2bdd75f3922ae41a1c9 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
class RPSCustomPainter extends CustomPainter { | |
@override | |
void paint(Canvas canvas, Size size) { | |
Paint paint = new Paint() | |
..color = Colors.blue | |
..style = PaintingStyle.stroke; | |
// Code for path | |
// From here .... | |
Path path = Path(); | |
path.moveTo(size.width * 0.07, size.height * 0.08); | |
path.quadraticBezierTo(size.width * 0.07, size.height * 0.04, | |
size.width * 0.13, size.height * 0.04); | |
path.cubicTo(size.width * 0.32, size.height * 0.04, size.width * 0.68, | |
size.height * 0.04, size.width * 0.87, size.height * 0.04); | |
path.quadraticBezierTo(size.width * 0.93, size.height * 0.04, | |
size.width * 0.93, size.height * 0.08); | |
path.quadraticBezierTo(size.width * 0.93, size.height * 0.44, | |
size.width * 0.93, size.height * 0.56); | |
path.cubicTo(size.width * 0.93, size.height * 0.72, size.width * 0.61, | |
size.height * 0.81, size.width * 0.53, size.height * 0.84); | |
path.quadraticBezierTo(size.width * 0.49, size.height * 0.85, | |
size.width * 0.46, size.height * 0.84); | |
path.quadraticBezierTo(size.width * 0.07, size.height * 0.72, | |
size.width * 0.07, size.height * 0.56); | |
path.quadraticBezierTo(size.width * 0.07, size.height * 0.44, | |
size.width * 0.07, size.height * 0.08); | |
path.close(); | |
// .... to here | |
canvas.drawPath(path, paint); | |
} | |
@override | |
bool shouldRepaint(covariant CustomPainter oldDelegate) { | |
return true; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment