24 lines
633 B
Dart
24 lines
633 B
Dart
import 'dart:math' as math;
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
class CirclePainter extends CustomPainter {
|
|
final double value;
|
|
final Color color; // New field for color
|
|
|
|
CirclePainter(this.value, this.color);
|
|
|
|
@override
|
|
void paint(Canvas canvas, Size size) {
|
|
var paint = Paint()
|
|
..color = color.withOpacity(0.5) // Use the passed color
|
|
..style = PaintingStyle.fill;
|
|
|
|
double radius = math.pow(((value + 5) * 500 / 100) / 1.5, 1.14).toDouble();
|
|
canvas.drawCircle(Offset(55, size.height / 4), radius, paint);
|
|
}
|
|
|
|
@override
|
|
bool shouldRepaint(covariant CustomPainter oldDelegate) => true;
|
|
}
|