mirror of
https://github.com/sadaks-me/chevrolet_app
synced 2025-01-09 19:03:14 +00:00
29 lines
750 B
Dart
29 lines
750 B
Dart
import 'package:flutter/material.dart';
|
|
import 'dart:math';
|
|
|
|
class RevealPainter extends CustomPainter {
|
|
double _fraction = 0.0;
|
|
Size _screenSize;
|
|
Color color;
|
|
|
|
RevealPainter(this._fraction, this._screenSize, this.color);
|
|
|
|
@override
|
|
void paint(Canvas canvas, Size size) {
|
|
var paint = Paint()
|
|
..color = color
|
|
..style = PaintingStyle.fill;
|
|
|
|
var finalRadius = sqrt(pow(_screenSize.width / 2, 2) +
|
|
pow(_screenSize.height - 32.0 - 48.0, 2));
|
|
print(finalRadius);
|
|
var radius = 24.0 + finalRadius * _fraction;
|
|
|
|
canvas.drawCircle(Offset(size.width / 2, size.height / 2), radius, paint);
|
|
}
|
|
|
|
@override
|
|
bool shouldRepaint(RevealPainter oldDelegate) {
|
|
return oldDelegate._fraction != _fraction;
|
|
}
|
|
}
|