2023-05-29 12:08:46 +02:00
|
|
|
import 'package:ernaehrung/android/components/meal_page_text/statistics_text_component.dart';
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:percent_indicator/linear_percent_indicator.dart';
|
|
|
|
|
|
|
|
class LineCircularWiTextComponent extends StatelessWidget {
|
|
|
|
final Color progressColor;
|
2023-05-30 17:28:16 +02:00
|
|
|
final double value;
|
2023-05-29 12:08:46 +02:00
|
|
|
final int total;
|
|
|
|
final String textName;
|
|
|
|
|
|
|
|
const LineCircularWiTextComponent(
|
2023-05-30 17:28:16 +02:00
|
|
|
this.progressColor, this.value, this.total, this.textName,
|
2023-05-29 12:08:46 +02:00
|
|
|
{super.key});
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
2023-05-30 17:28:16 +02:00
|
|
|
double progress = double.parse((value/total).toStringAsFixed(1));
|
2023-05-29 12:08:46 +02:00
|
|
|
return Padding(
|
|
|
|
padding: const EdgeInsets.symmetric(vertical: 0, horizontal: 8),
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
2023-05-30 17:28:16 +02:00
|
|
|
StaticsTextComponent(double.parse(value.toString()).toStringAsFixed(2), true),
|
2023-05-29 12:08:46 +02:00
|
|
|
const SizedBox(height: 4,),
|
|
|
|
LinearPercentIndicator(
|
|
|
|
padding: EdgeInsets.zero,
|
|
|
|
lineHeight: 8.0,
|
2023-05-30 17:28:16 +02:00
|
|
|
percent: progress,
|
2023-05-29 12:08:46 +02:00
|
|
|
progressColor: progressColor,
|
|
|
|
),
|
|
|
|
const SizedBox(height: 4,),
|
|
|
|
StaticsTextComponent(textName, false),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|