2023-06-16 08:34:41 +02:00
|
|
|
import 'package:ernaehrung/android/components/chart/chart.dart';
|
2023-05-29 12:08:46 +02:00
|
|
|
import 'package:ernaehrung/android/components/meal_page_text/secondary_text_component.dart';
|
|
|
|
import 'package:ernaehrung/android/components/meal_page_text/title_component.dart';
|
2023-05-30 22:09:16 +02:00
|
|
|
import 'package:ernaehrung/android/config/statistics.dart';
|
2023-05-29 12:08:46 +02:00
|
|
|
import 'package:flutter/material.dart';
|
2023-05-30 22:09:16 +02:00
|
|
|
import '../../config/format_helper.dart';
|
|
|
|
|
2023-05-29 12:08:46 +02:00
|
|
|
class ProgressPage extends StatelessWidget {
|
|
|
|
final String title;
|
|
|
|
final Color backgroundColor = const Color(0xff47a44b);
|
|
|
|
|
|
|
|
const ProgressPage({Key? key, required this.title}) : super(key: key);
|
|
|
|
|
|
|
|
String get getTitle => title;
|
|
|
|
|
|
|
|
@override
|
|
|
|
String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) {
|
|
|
|
return getTitle;
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return Scaffold(
|
|
|
|
body: SingleChildScrollView(
|
2023-06-02 01:42:56 +02:00
|
|
|
child: Column(
|
|
|
|
children: [
|
2023-06-16 08:34:41 +02:00
|
|
|
const ChartComponent(),
|
2023-06-02 01:42:56 +02:00
|
|
|
Container(
|
|
|
|
margin: const EdgeInsets.fromLTRB(0, 16, 0, 0),
|
|
|
|
decoration: const BoxDecoration(
|
|
|
|
color: Colors.white,
|
|
|
|
borderRadius: BorderRadius.all(Radius.circular(8))),
|
|
|
|
child: Padding(
|
|
|
|
padding:
|
|
|
|
const EdgeInsets.symmetric(vertical: 8, horizontal: 16),
|
|
|
|
child: ValueListenableBuilder(
|
|
|
|
valueListenable:
|
|
|
|
StatisticsService.instance.weeklyCaloryRanking,
|
|
|
|
builder: (context, value, child) {
|
|
|
|
return Column(
|
|
|
|
children: [
|
|
|
|
const TitleComponent(
|
|
|
|
"Lebensmittel mit dem höchsten Kaloriengehalt"),
|
|
|
|
const SizedBox(
|
2023-06-16 11:44:42 +02:00
|
|
|
height: 5,
|
2023-06-02 01:42:56 +02:00
|
|
|
),
|
2023-06-16 11:44:42 +02:00
|
|
|
for (var item in value)
|
2023-06-02 01:42:56 +02:00
|
|
|
Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
children: [
|
|
|
|
SecondaryTextComponent(
|
2023-06-16 11:44:42 +02:00
|
|
|
getWeeklyRankingString(item.name),
|
|
|
|
value.indexOf(item)+1
|
|
|
|
),
|
2023-06-02 01:42:56 +02:00
|
|
|
SecondaryTextComponent(
|
2023-06-16 11:44:42 +02:00
|
|
|
item.calories.toString(),
|
|
|
|
null
|
|
|
|
),
|
2023-06-02 01:42:56 +02:00
|
|
|
],
|
|
|
|
),
|
|
|
|
],
|
|
|
|
);
|
|
|
|
},
|
|
|
|
),
|
|
|
|
))
|
|
|
|
],
|
2023-05-29 12:08:46 +02:00
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|