Skip to content

Instantly share code, notes, and snippets.

@rayliverified
Created April 14, 2023 18:28
Show Gist options
  • Save rayliverified/60bce5dff5a0b3540d5e71f2fc66dc13 to your computer and use it in GitHub Desktop.
Save rayliverified/60bce5dff5a0b3540d5e71f2fc66dc13 to your computer and use it in GitHub Desktop.
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