My circle painter:
CircleWavePainter(this.animationValue) {
//add some property to paint
wavePaint = Paint()
..color = Colors.black.withAlpha(100)
..style = PaintingStyle.stroke
..strokeWidth = 1
..isAntiAlias = true;
}
My paint to draw 2 circles and need some help to fill the space:
void paint(Canvas canvas, Size size) {
//circle 1
canvas.drawCircle(Offset(size.height / 2, size.width / 2),
80 * (1.4 - animationValue / 2), wavePaint);
//circle 2
canvas.drawCircle(Offset(size.height / 2, size.width / 2),
80 * (1.8 - animationValue / 2), wavePaint);
}
Using 'Stack' widget instead of 'Paint', implemented your design.
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
visualDensity: VisualDensity.adaptivePlatformDensity,
),
home: MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);
final String title;
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: _buildBody(),
);
}
Widget _buildBody() {
return Container(
height: 400,
width: 400,
child: Stack(
alignment: AlignmentDirectional.center,
children: [
Container(
width: 280,
height: 280,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Color(0xFF4C4D4F),
),
),
Container(
width: 200,
height: 200,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.white,
),
),
Container(
width: 140,
height: 140,
child: Icon(
Icons.access_alarm,
color: Colors.white,
size: 30,
),
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Color(0xFF5EA2EB),
),
)
],
),
);
}
}