Flutter-Ernaehrungsapp/lib/android/components/circular/circular_component.dart

21 lines
710 B
Dart
Raw Normal View History

2023-05-29 12:08:46 +02:00
import 'package:flutter/material.dart';
import 'package:percent_indicator/circular_percent_indicator.dart';
class CircularLoadingComponent extends StatelessWidget {
2023-05-30 16:17:51 +02:00
final int eatenCalories;
const CircularLoadingComponent(this.eatenCalories, {Key? key}) : super(key: key);
final int targetCaolries = 3500; // TODO get from user data
2023-05-29 12:08:46 +02:00
@override
Widget build(BuildContext context) {
2023-05-30 16:17:51 +02:00
double progress = double.parse((eatenCalories/targetCaolries).toStringAsFixed(1));
2023-05-29 12:08:46 +02:00
return CircularPercentIndicator(
animation: true,
radius: 60.0,
lineWidth: 5.0,
2023-05-30 16:17:51 +02:00
percent: progress,
center: Text("${progress*100} %"),
2023-05-29 12:08:46 +02:00
progressColor: Colors.lightGreen,
);
}
}