21 lines
521 B
Dart
21 lines
521 B
Dart
|
import 'package:flutter/material.dart';
|
||
|
|
||
|
class CirclePainter extends CustomPainter {
|
||
|
final double value;
|
||
|
|
||
|
CirclePainter(this.value);
|
||
|
|
||
|
@override
|
||
|
void paint(Canvas canvas, Size size) {
|
||
|
var paint = Paint()
|
||
|
..color = Colors.greenAccent.withOpacity(0.5)
|
||
|
..style = PaintingStyle.fill;
|
||
|
|
||
|
double radius = value * size.width / 100 * 1.5;
|
||
|
canvas.drawCircle(Offset(size.width / 6, size.height / 4), radius, paint);
|
||
|
}
|
||
|
|
||
|
@override
|
||
|
bool shouldRepaint(covariant CustomPainter oldDelegate) => true;
|
||
|
}
|