ESP32 | FLUTTER | FIREBASE - Temperature & Humidity Check App

This commit is contained in:
Eric
2019-07-22 00:40:06 -07:00
parent a4597ab575
commit e8b26483f5
65 changed files with 2895 additions and 0 deletions

View File

@@ -0,0 +1,47 @@
import 'dart:math';
import 'package:flutter/material.dart';
class CircleProgress extends CustomPainter {
double value;
bool isTemp;
CircleProgress(this.value, this.isTemp);
@override
bool shouldRepaint(CustomPainter oldDelegate) {
return true;
}
@override
void paint(Canvas canvas, Size size) {
int maximumValue =
isTemp ? 50 : 100; // Temp's max is 50, Humidity's max is 100
Paint outerCircle = Paint()
..strokeWidth = 14
..color = Colors.grey
..style = PaintingStyle.stroke;
Paint tempArc = Paint()
..strokeWidth = 14
..color = Colors.red
..style = PaintingStyle.stroke
..strokeCap = StrokeCap.round;
Paint humidityArc = Paint()
..strokeWidth = 14
..color = Colors.blue
..style = PaintingStyle.stroke
..strokeCap = StrokeCap.round;
Offset center = Offset(size.width / 2, size.height / 2);
double radius = min(size.width / 2, size.height / 2) - 14;
canvas.drawCircle(center, radius, outerCircle);
double angle = 2 * pi * (value / maximumValue);
canvas.drawArc(Rect.fromCircle(center: center, radius: radius), -pi / 2,
angle, false, isTemp ? tempArc : humidityArc);
}
}