Introduction to CustomPainter
Notes
In this lesson, we implement two classes:
TaskCompletionRingas aStatelessWidgetRingPainteras aCustomPainter
When implementing a CustomPainter, we need to override the paint() and shouldRepaint() methods.
The paint() method has two arguments:
- a
canvasobject that we can use to draw things - a
sizeobject that tells us how big is the drawing area
shouldRepaint() should return true when something has changed.
We can use an AspectRatio to enforce a certain proportion of width to height (in this case: 1.0).
Here's a full tutorial on how to use CustomPainter:
0 comments