Flutter-Ernaehrungsapp/lib/android/components/circular/line_circular_with_text_com...

39 lines
1.2 KiB
Dart
Raw Normal View History

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;
final double value;
2023-05-29 12:08:46 +02:00
final int total;
final String textName;
const LineCircularWiTextComponent(
this.progressColor, this.value, this.total, this.textName,
2023-05-29 12:08:46 +02:00
{super.key});
@override
Widget build(BuildContext context) {
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: [
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,
percent: progress,
2023-05-29 12:08:46 +02:00
progressColor: progressColor,
),
const SizedBox(height: 4,),
StaticsTextComponent(textName, false),
],
),
);
}
}