Last active
April 9, 2020 09:56
-
-
Save divyanshub024/cc271febc332416da4344f4bebb177d7 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
@override | |
void paint(Canvas canvas, Size size) { | |
var path = createPath(); | |
canvas.drawPath(path, myPaint); | |
} | |
Path createPath() { | |
var path = Path(); | |
int n = circles.toInt(); | |
var range = List<int>.generate(n, (i) => i + 1); | |
double angle = 2 * math.pi / n; | |
for (int i in range) { | |
double x = radius * math.cos(i * angle); | |
double y = radius * math.sin(i * angle); | |
path.addOval(Rect.fromCircle(center: Offset(x, y), radius: radius)); | |
} | |
return path; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment