Created
April 14, 2023 18:28
-
-
Save rayliverified/60bce5dff5a0b3540d5e71f2fc66dc13 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
class CustomTrianglePainter extends CustomPainter { | |
final Color color; | |
late Paint _paint; | |
CustomTrianglePainter(this.color) { | |
_paint = Paint() | |
..color = color | |
..style = PaintingStyle.fill; | |
} | |
@override | |
void paint(Canvas canvas, Size size) { | |
var path = Path(); | |
path.moveTo(size.width / 2, 0); | |
path.lineTo(0, size.height); | |
path.lineTo(size.width, size.height); | |
path.close(); | |
canvas.drawPath(path, _paint); | |
} | |
@override | |
bool shouldRepaint(CustomPainter oldDelegate) { | |
return false; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment