Skip to content

Instantly share code, notes, and snippets.

@divyanshub024
Last active April 9, 2020 09:56
Show Gist options
  • Save divyanshub024/cc271febc332416da4344f4bebb177d7 to your computer and use it in GitHub Desktop.
Save divyanshub024/cc271febc332416da4344f4bebb177d7 to your computer and use it in GitHub Desktop.
@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