chevrolet_app/lib/utils/reveal/reveal_painter.dart
2019-02-10 23:00:51 +05:30

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;
}
}