Created
February 9, 2023 01:45
-
-
Save ponnamkarthik/9356f700123ce14defe9cf30bef7b94c 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 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