In this lesson, we implement two classes:
TaskCompletionRing as a StatelessWidget
RingPainter as a CustomPainter
When implementing a CustomPainter, we need to override the paint() and shouldRepaint() methods.
The paint() method has two arguments:
canvas object that we can use to draw thingssize object that tells us how big is the drawing areashouldRepaint() 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