I am trying to draw a half circle in a rectangle in flutter like this.
But in my code, the Circle exceeds the white rectangle onto the black background like this
What changes should I make to the code to get the result like the first pic?
My code:-
import 'package:flutter/material.dart';
class Test extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: SafeArea(
child: Scaffold(
backgroundColor: Colors.black,
body: Center(
child: Container(
height: 200,
width: 200,
color: Colors.white,
child: CustomPaint(
painter: Circ(),
child: Column(
children: <Widget>[
],
),
),
),
),
)
),
);
}
}
class Circ extends CustomPainter{
@override
void paint(Canvas canvas, Size size) {
final paint = Paint();
paint.color = Colors.blue.withOpacity(0.2);
var center1 = Offset(200,100);
canvas.drawCircle(center1,100, paint);
}
@override
bool shouldRepaint(CustomPainter oldDelegate) {
return null;
}
}

