Created
December 2, 2022 20:03
-
-
Save jonahwilliams/14df3fdcaa8f01b05f69ab83ba8dd7f8 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 ExpensivePainter extends CustomPainter { | |
@override | |
void paint(Canvas canvas, Size size) { | |
final double boxWidth = size.width / 50; | |
final double boxHeight = size.height / 50; | |
for (int i = 0; i < 50; i++) { | |
for (int j = 0; j < 50; j++) { | |
final Rect rect = Rect.fromLTWH(i * boxWidth, j * boxHeight, boxWidth, boxHeight); | |
canvas.drawRect(rect, Paint() | |
..style = PaintingStyle.fill | |
..color = Colors.red | |
); | |
} | |
} | |
} | |
@override | |
bool shouldRepaint(covariant CustomPainter oldDelegate) { | |
return false; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment