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