ModernMemoires/lib/utils/CirclePainter.dart

26 lines
686 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) {
print("CirclePainter " + value.toString());
}
@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;
}