我如何在 2 个圆圈之间填充 space?

How I can fill space between 2 circle in flutter?

我圈画师:

    CircleWavePainter(this.animationValue) {
//add some property to paint
  wavePaint = Paint()
    ..color = Colors.black.withAlpha(100)
    ..style = PaintingStyle.stroke
    ..strokeWidth = 1
    ..isAntiAlias = true;
}

我要画 2 个圆圈,需要一些帮助来填充 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);
}

你可以使用堆栈小部件我没有在我的课程中达到动画但我可以给你一个提示

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
        ],
      )

使用 'Stack' 小部件代替 'Paint',实现了您的设计。

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),
            ),
          )
        ],
      ),
    );
  }
}