ModernMemoires/lib/utils/CirclePainter.dart

24 lines
645 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(size.width / 6, size.height / 4), radius, paint);
}
@override
bool shouldRepaint(covariant CustomPainter oldDelegate) => true;
}