Skip to content

Instantly share code, notes, and snippets.

@ponnamkarthik
Created February 9, 2023 01:45
Show Gist options
  • Save ponnamkarthik/9356f700123ce14defe9cf30bef7b94c to your computer and use it in GitHub Desktop.
Save ponnamkarthik/9356f700123ce14defe9cf30bef7b94c to your computer and use it in GitHub Desktop.
class MyPainter extends CustomPainter {
final Paint paint;
MyPainter(this.paint);
@override
void paint(Canvas canvas, Size size) {
canvas.drawRect(
Rect.fromLTRB(0, 0, size.width, size.height),
paint,
);
}
@override
bool shouldRepaint(MyPainter oldDelegate) {
return oldDelegate.paint != paint;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment