0

illustration

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);
}
MendelG
  • 14,885
  • 4
  • 25
  • 52

2 Answers2

1

you can use stack Widget I didn't reach animations on my course but I can give you a hint

Stack(
        alignment: AlignmentDirectional.bottomEnd,
        children: [
          CircleAvatar(
            radius: 30,
            backgroundImage: NetworkImage(
              'https://thispersondoesnotexist.com/image',
            ),
          ), //photo
          CircleAvatar(
            radius: 7,
            backgroundColor: Colors.white,
          ), // active or not
          CircleAvatar(
            radius: 6,
            backgroundColor: Colors.green,
          ), // active circle space
        ],
      )
Abdallah
  • 31
  • 2
0

Using 'Stack' widget instead of 'Paint', implemented your design.

enter image description here

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),
            ),
          )
        ],
      ),
    );
  }
}
KuKu
  • 6,654
  • 1
  • 13
  • 25