In this article, I'm going to share you the code for creating a Circle using Canvas in Flutter as below.
class DrawCircle extends CustomPainter { Paint _paint; DrawCircle() { _paint = Paint() ..color = Colors.green ..strokeWidth = 10.0 ..style = PaintingStyle.fill; } @override void paint(Canvas canvas, Size size) { canvas.drawCircle(Offset(0.0, 0.0), 100.0, _paint); } @override bool shouldRepaint(CustomPainter oldDelegate) { return false; } }
In order to create a Circle in your program, you can follow the below example.
body: Center( child: Container( child: CustomPaint(painter: DrawCircle()), ), )
Hope this example will be useful to you.
Thanks,
Srikanth