ModernMemoires/lib/utils/circle_painter.dart

24 lines
627 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(const Offset(10, 109), radius, paint);
}
@override
bool shouldRepaint(covariant CustomPainter oldDelegate) => true;
}