optimierung
parent
c91f3901dd
commit
a989878cca
|
@ -14,7 +14,7 @@ class AndroidApp extends StatelessWidget {
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
title: 'Flutter Demo',
|
title: 'Flutter Demo',
|
||||||
theme: ThemeData(
|
theme: ThemeData(
|
||||||
scaffoldBackgroundColor: Colors.grey.shade100, //<-- SEE
|
scaffoldBackgroundColor: Colors.grey.shade200, //<-- SEE
|
||||||
),
|
),
|
||||||
home: box.get("USER") == null ? const OnboardingPage() : const MainPage(),
|
home: box.get("USER") == null ? const OnboardingPage() : const MainPage(),
|
||||||
routes: {
|
routes: {
|
||||||
|
|
|
@ -45,12 +45,9 @@ class CardComponent extends StatelessWidget {
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Container(
|
return Container(
|
||||||
height: 300,
|
height: 300,
|
||||||
decoration: BoxDecoration(
|
decoration: const BoxDecoration(
|
||||||
color: const Color(0xFF6E7BFB),
|
color: Color(0xFF6E7BFB),
|
||||||
borderRadius: const BorderRadius.all(Radius.circular(16)),
|
borderRadius: BorderRadius.all(Radius.circular(16)),
|
||||||
border: Border.all(
|
|
||||||
color: Colors.black,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
margin: const EdgeInsets.fromLTRB(0, 16, 0, 16),
|
margin: const EdgeInsets.fromLTRB(0, 16, 0, 16),
|
||||||
child: Column(
|
child: Column(
|
||||||
|
|
|
@ -11,7 +11,10 @@ class CardComponent extends StatefulWidget {
|
||||||
final bool addButtonVisible;
|
final bool addButtonVisible;
|
||||||
|
|
||||||
const CardComponent(
|
const CardComponent(
|
||||||
{Key? key, required this.eatingMealName, required this.selectedMeal, this.addButtonVisible = true})
|
{Key? key,
|
||||||
|
required this.eatingMealName,
|
||||||
|
required this.selectedMeal,
|
||||||
|
this.addButtonVisible = true})
|
||||||
: super(key: key);
|
: super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -40,11 +43,14 @@ class _CardComponentState extends State<CardComponent> {
|
||||||
}
|
}
|
||||||
|
|
||||||
getImageOfMeal() {
|
getImageOfMeal() {
|
||||||
if (widget.eatingMealName.toLowerCase() == dotenv.env['BREAKFAST_FIELD']!.toLowerCase()) {
|
if (widget.eatingMealName.toLowerCase() ==
|
||||||
|
dotenv.env['BREAKFAST_FIELD']!.toLowerCase()) {
|
||||||
return const Image(image: AssetImage('assets/images/tea.png'));
|
return const Image(image: AssetImage('assets/images/tea.png'));
|
||||||
} else if (widget.eatingMealName.toLowerCase() == dotenv.env['LUNCH_FIELD']!.toLowerCase()) {
|
} else if (widget.eatingMealName.toLowerCase() ==
|
||||||
|
dotenv.env['LUNCH_FIELD']!.toLowerCase()) {
|
||||||
return const Image(image: AssetImage('assets/images/fries.png'));
|
return const Image(image: AssetImage('assets/images/fries.png'));
|
||||||
} else if (widget.eatingMealName.toLowerCase() == dotenv.env['DINNER_FIELD']!.toLowerCase()) {
|
} else if (widget.eatingMealName.toLowerCase() ==
|
||||||
|
dotenv.env['DINNER_FIELD']!.toLowerCase()) {
|
||||||
return const Image(image: AssetImage('assets/images/ice.png'));
|
return const Image(image: AssetImage('assets/images/ice.png'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -77,7 +83,6 @@ class _CardComponentState extends State<CardComponent> {
|
||||||
} else {
|
} else {
|
||||||
return const SizedBox.shrink();
|
return const SizedBox.shrink();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int getCountedCalories() {
|
int getCountedCalories() {
|
||||||
|
@ -94,22 +99,14 @@ class _CardComponentState extends State<CardComponent> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Card(
|
return Container(
|
||||||
margin: const EdgeInsets.fromLTRB(0, 24, 0, 0),
|
margin: const EdgeInsets.fromLTRB(0, 16, 0, 0),
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
|
||||||
Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
||||||
children: [
|
children: [
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
getImageOfMeal(),
|
getImageOfMeal(),
|
||||||
Column(
|
Text(
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
SizedBox(
|
|
||||||
width: MediaQuery.of(context).size.width * 0.6,
|
|
||||||
child: Text(
|
|
||||||
StringUtils.capitalize(widget.eatingMealName),
|
StringUtils.capitalize(widget.eatingMealName),
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
|
@ -119,35 +116,35 @@ class _CardComponentState extends State<CardComponent> {
|
||||||
fontWeight: FontWeight.w500,
|
fontWeight: FontWeight.w500,
|
||||||
fontSize: 14),
|
fontSize: 14),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
],
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
getElevatedButton(),
|
getElevatedButton(),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: MediaQuery.of(context).size.width * 0.8,
|
width: MediaQuery.of(context).size.width * 1,
|
||||||
child: ListView.builder(
|
child: ListView.builder(
|
||||||
primary: false,
|
primary: false,
|
||||||
shrinkWrap: true,
|
shrinkWrap: true,
|
||||||
itemCount: getMapOfDistinctElementsWithCounterAndCalories(widget.selectedMeal).keys.length,
|
itemCount: getMapOfDistinctElementsWithCounterAndCalories(
|
||||||
|
widget.selectedMeal)
|
||||||
|
.keys
|
||||||
|
.length,
|
||||||
itemBuilder: (context, i) {
|
itemBuilder: (context, i) {
|
||||||
Map<String,List<int>> map = getMapOfDistinctElementsWithCounterAndCalories(widget.selectedMeal);
|
Map<String, List<int>> map =
|
||||||
|
getMapOfDistinctElementsWithCounterAndCalories(
|
||||||
|
widget.selectedMeal);
|
||||||
String foodName = map.keys.elementAt(i);
|
String foodName = map.keys.elementAt(i);
|
||||||
List<int> values = map.values.elementAt(i);
|
List<int> values = map.values.elementAt(i);
|
||||||
return Text(
|
return Text(getFoodListStringByFood(
|
||||||
getFoodListStringByFood(foodName, values[0], values[1])
|
foodName, values[0], values[1]));
|
||||||
);
|
}),
|
||||||
}
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
widget.selectedMeal.isNotEmpty
|
widget.selectedMeal.isNotEmpty
|
||||||
? const Divider()
|
? Column(
|
||||||
: const SizedBox.shrink(),
|
children: [
|
||||||
widget.selectedMeal.isNotEmpty
|
const Divider(),
|
||||||
? Text("${getCountedCalories()} kcal")
|
Text("${getCountedCalories()} kcal")
|
||||||
|
],
|
||||||
|
)
|
||||||
: const SizedBox.shrink(),
|
: const SizedBox.shrink(),
|
||||||
],
|
],
|
||||||
));
|
));
|
||||||
|
|
|
@ -10,17 +10,18 @@ class MealPageStatisticsFoodComponent extends StatelessWidget {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Container(
|
return Container(
|
||||||
|
margin: const EdgeInsets.fromLTRB(0, 16, 0, 0),
|
||||||
|
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 16),
|
||||||
decoration: const BoxDecoration(
|
decoration: const BoxDecoration(
|
||||||
color: Colors.white
|
color: Colors.white,
|
||||||
),
|
borderRadius: BorderRadius.all(Radius.circular(8))),
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
const SizedBox(
|
|
||||||
height: 24,
|
|
||||||
),
|
|
||||||
const TitleComponent("Nahrung"),
|
const TitleComponent("Nahrung"),
|
||||||
FoodComponent(box: Hive.box(StatisticsService.instance.todayStatisticsBoxName),)
|
FoodComponent(
|
||||||
|
box: Hive.box(StatisticsService.instance.todayStatisticsBoxName),
|
||||||
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
|
@ -34,9 +34,7 @@ class _DaysMealPageState extends State<DaysMealPageComponent> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Padding(
|
return Row(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 0),
|
|
||||||
child: Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
DaysTextComponent(
|
DaysTextComponent(
|
||||||
|
@ -65,7 +63,6 @@ class _DaysMealPageState extends State<DaysMealPageComponent> {
|
||||||
index: 2
|
index: 2
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,8 +15,6 @@ class StatisticsPercentage extends StatelessWidget {
|
||||||
valueListenable: StatisticsService.instance.ingredients,
|
valueListenable: StatisticsService.instance.ingredients,
|
||||||
builder: (context, value, child) {
|
builder: (context, value, child) {
|
||||||
return Container(
|
return Container(
|
||||||
decoration: BoxDecoration(
|
|
||||||
border: Border.all(width: 2.0, color: Colors.black)),
|
|
||||||
height: heightStatisticsContainer,
|
height: heightStatisticsContainer,
|
||||||
padding: const EdgeInsets.symmetric(vertical: 16, horizontal: 0),
|
padding: const EdgeInsets.symmetric(vertical: 16, horizontal: 0),
|
||||||
child: Row(
|
child: Row(
|
||||||
|
|
|
@ -36,9 +36,12 @@ class MainPageState extends State<MainPage> {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
|
extendBodyBehindAppBar: false,
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: Text(pages[currentIndex].title),
|
title: Text(pages[currentIndex].title),
|
||||||
backgroundColor: Colors.grey.shade100,
|
backgroundColor: Colors.transparent,
|
||||||
|
foregroundColor: Colors.grey.shade400,
|
||||||
|
elevation: 0,
|
||||||
),
|
),
|
||||||
body: Padding(
|
body: Padding(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 0, horizontal: 8),
|
padding: const EdgeInsets.symmetric(vertical: 0, horizontal: 8),
|
||||||
|
|
|
@ -24,16 +24,28 @@ class _MealPlanState extends State<MealPlanPage> {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
body: Container(
|
body: SizedBox(
|
||||||
margin: const EdgeInsets.all(8),
|
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
height: double.infinity,
|
height: double.infinity,
|
||||||
child: SingleChildScrollView(
|
child: SingleChildScrollView(
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
decoration: const BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
borderRadius: BorderRadius.all(Radius.circular(8))),
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(
|
||||||
|
vertical: 8, horizontal: 16),
|
||||||
child: Column(
|
child: Column(
|
||||||
children: const [
|
children: const [
|
||||||
DaysMealPageComponent(),
|
DaysMealPageComponent(),
|
||||||
StatisticsPercentage(),
|
StatisticsPercentage(),
|
||||||
MealPageStatisticsFoodComponent(),
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const MealPageStatisticsFoodComponent(),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
)));
|
)));
|
||||||
|
|
|
@ -20,19 +20,24 @@ class ProgressPage extends StatelessWidget {
|
||||||
return getTitle;
|
return getTitle;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* TODO: in versch. Dateien auslagern, damit der Code nicht voll gemüllt wird
|
|
||||||
* */
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
body: SingleChildScrollView(
|
body: SingleChildScrollView(
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
decoration: const BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
borderRadius: BorderRadius.all(Radius.circular(8))),
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 16, horizontal: 8),
|
padding:
|
||||||
|
const EdgeInsets.symmetric(vertical: 8, horizontal: 16),
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
ValueListenableBuilder(
|
ValueListenableBuilder(
|
||||||
valueListenable: StatisticsService.instance.dailyAverageForCurrentWeek,
|
valueListenable: StatisticsService
|
||||||
|
.instance.dailyAverageForCurrentWeek,
|
||||||
builder: (context, value, child) {
|
builder: (context, value, child) {
|
||||||
return SizedBox(
|
return SizedBox(
|
||||||
height: 100,
|
height: 100,
|
||||||
|
@ -40,86 +45,111 @@ class ProgressPage extends StatelessWidget {
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
const TitleComponent("Täglicher Durchschnitt (in kcal)"),
|
const TitleComponent("Kalorien"),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 10,
|
height: 10,
|
||||||
),
|
),
|
||||||
const SecondaryTextComponent("Durchschnittlich"),
|
const SecondaryTextComponent(
|
||||||
SecondaryBigTextComponent("${value.toString()} kcal/Tag"),
|
"Durchschnittlich"),
|
||||||
|
SecondaryBigTextComponent(
|
||||||
|
"${value.toString()} kcal/Tag"),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
ValueListenableBuilder(
|
ValueListenableBuilder(
|
||||||
valueListenable: StatisticsService.instance.barChartData,
|
valueListenable:
|
||||||
|
StatisticsService.instance.barChartData,
|
||||||
builder: (context, value, child) {
|
builder: (context, value, child) {
|
||||||
return SizedBox(
|
return SizedBox(
|
||||||
height: 325,
|
height: 300,
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 15, // Adjust the height of the legend as needed
|
height: 15,
|
||||||
|
// Adjust the height of the legend as needed
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
Container(
|
Container(
|
||||||
margin: const EdgeInsets.symmetric(horizontal: 8.0), // Adjust the spacing between legend items
|
margin: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 8.0),
|
||||||
|
// Adjust the spacing between legend items
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Container(
|
Container(
|
||||||
width: 12,
|
width: 12,
|
||||||
height: 12,
|
height: 12,
|
||||||
decoration: const BoxDecoration(
|
decoration: const BoxDecoration(
|
||||||
color: Colors.red, // Use the color of the first bar rod for the legend item
|
color: Colors.red,
|
||||||
|
// Use the color of the first bar rod for the legend item
|
||||||
shape: BoxShape.circle,
|
shape: BoxShape.circle,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 4.0), // Adjust the spacing between the color indicator and the legend label
|
const SizedBox(width: 4.0),
|
||||||
|
// Adjust the spacing between the color indicator and the legend label
|
||||||
const Text(
|
const Text(
|
||||||
'Frühstück', // Replace with your desired legend label
|
'Frühstück',
|
||||||
style: TextStyle(fontSize: 12), // Adjust the font size of the legend labels
|
// Replace with your desired legend label
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize:
|
||||||
|
12), // Adjust the font size of the legend labels
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Container(
|
Container(
|
||||||
margin: const EdgeInsets.symmetric(horizontal: 8.0), // Adjust the spacing between legend items
|
margin: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 8.0),
|
||||||
|
// Adjust the spacing between legend items
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Container(
|
Container(
|
||||||
width: 12,
|
width: 12,
|
||||||
height: 12,
|
height: 12,
|
||||||
decoration: const BoxDecoration(
|
decoration: const BoxDecoration(
|
||||||
color: Colors.green, // Use the color of the first bar rod for the legend item
|
color: Colors.green,
|
||||||
|
// Use the color of the first bar rod for the legend item
|
||||||
shape: BoxShape.circle,
|
shape: BoxShape.circle,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 4.0), // Adjust the spacing between the color indicator and the legend label
|
const SizedBox(width: 4.0),
|
||||||
|
// Adjust the spacing between the color indicator and the legend label
|
||||||
const Text(
|
const Text(
|
||||||
'Mittagessen', // Replace with your desired legend label
|
'Mittagessen',
|
||||||
style: TextStyle(fontSize: 12), // Adjust the font size of the legend labels
|
// Replace with your desired legend label
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize:
|
||||||
|
12), // Adjust the font size of the legend labels
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Container(
|
Container(
|
||||||
margin: const EdgeInsets.symmetric(horizontal: 8.0), // Adjust the spacing between legend items
|
margin: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 8.0),
|
||||||
|
// Adjust the spacing between legend items
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Container(
|
Container(
|
||||||
width: 12,
|
width: 12,
|
||||||
height: 12,
|
height: 12,
|
||||||
decoration: const BoxDecoration(
|
decoration: const BoxDecoration(
|
||||||
color: Colors.yellow, // Use the color of the first bar rod for the legend item
|
color: Colors.yellow,
|
||||||
|
// Use the color of the first bar rod for the legend item
|
||||||
shape: BoxShape.circle,
|
shape: BoxShape.circle,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 4.0), // Adjust the spacing between the color indicator and the legend label
|
const SizedBox(width: 4.0),
|
||||||
|
// Adjust the spacing between the color indicator and the legend label
|
||||||
const Text(
|
const Text(
|
||||||
'Abendessen', // Replace with your desired legend label
|
'Abendessen',
|
||||||
style: TextStyle(fontSize: 12), // Adjust the font size of the legend labels
|
// Replace with your desired legend label
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize:
|
||||||
|
12), // Adjust the font size of the legend labels
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
@ -127,9 +157,9 @@ class ProgressPage extends StatelessWidget {
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Padding(
|
Container(
|
||||||
padding: const EdgeInsets.only(top:50.0), // Adjust the margin value as needed
|
margin:
|
||||||
child: SizedBox(
|
const EdgeInsets.fromLTRB(0, 24, 0, 0),
|
||||||
height: 250,
|
height: 250,
|
||||||
child: BarChart(
|
child: BarChart(
|
||||||
BarChartData(
|
BarChartData(
|
||||||
|
@ -142,38 +172,52 @@ class ProgressPage extends StatelessWidget {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
ValueListenableBuilder(
|
],
|
||||||
valueListenable: StatisticsService.instance.weeklyCaloryRanking,
|
),
|
||||||
|
)),
|
||||||
|
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) {
|
builder: (context, value, child) {
|
||||||
return Column(
|
return Column(
|
||||||
//TODO: Loop through the values and display them dynamically
|
|
||||||
children: [
|
children: [
|
||||||
const TitleComponent("Lebensmittel mit dem höchsten Kaloriengehalt"),
|
const TitleComponent(
|
||||||
const SizedBox(height: 24,),
|
"Lebensmittel mit dem höchsten Kaloriengehalt"),
|
||||||
|
const SizedBox(
|
||||||
|
height: 24,
|
||||||
|
),
|
||||||
for (var item in value.toSet())
|
for (var item in value.toSet())
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
SecondaryTextComponent(getWeeklyRankingString(item.name)),
|
SecondaryTextComponent(
|
||||||
SecondaryTextComponent(item.calories.toString()),
|
getWeeklyRankingString(item.name)),
|
||||||
|
SecondaryTextComponent(
|
||||||
|
item.calories.toString()),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
))
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BarTouchData get barTouchData => BarTouchData(
|
BarTouchData get barTouchData => BarTouchData(
|
||||||
|
@ -262,9 +306,11 @@ class ProgressPage extends StatelessWidget {
|
||||||
getTitlesWidget: (value, _) {
|
getTitlesWidget: (value, _) {
|
||||||
// Return a custom widget for each axis value
|
// Return a custom widget for each axis value
|
||||||
return Container(
|
return Container(
|
||||||
constraints: const BoxConstraints.tightFor(width: double.infinity),
|
constraints:
|
||||||
|
const BoxConstraints.tightFor(width: double.infinity),
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.only(right: 3.0), // Adjust the margin value as needed
|
padding: const EdgeInsets.only(right: 3.0),
|
||||||
|
// Adjust the margin value as needed
|
||||||
child: FittedBox(
|
child: FittedBox(
|
||||||
fit: BoxFit.scaleDown,
|
fit: BoxFit.scaleDown,
|
||||||
alignment: Alignment.centerLeft,
|
alignment: Alignment.centerLeft,
|
||||||
|
@ -280,16 +326,14 @@ class ProgressPage extends StatelessWidget {
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
)
|
));
|
||||||
);
|
|
||||||
|
|
||||||
FlBorderData get borderData => FlBorderData(
|
FlBorderData get borderData => FlBorderData(
|
||||||
show: true, // Set to true to display the chart border
|
show: true, // Set to true to display the chart border
|
||||||
border: const Border(
|
border: const Border(
|
||||||
bottom: BorderSide(color: Colors.black, width: 1),
|
bottom: BorderSide(color: Colors.black, width: 1),
|
||||||
left: BorderSide(color: Colors.black, width: 1),// Hide the left border
|
left:
|
||||||
|
BorderSide(color: Colors.black, width: 1), // Hide the left border
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,9 +23,7 @@ void main() async {
|
||||||
await Hive.openBox(dotenv.env['STATISTICS_MAIN_BOX'] ?? 'STATISTICS_MAIN_BOX');
|
await Hive.openBox(dotenv.env['STATISTICS_MAIN_BOX'] ?? 'STATISTICS_MAIN_BOX');
|
||||||
await Hive.openBox(dotenv.env['MEALPLAN_BOX'] ?? 'MEALPLAN');
|
await Hive.openBox(dotenv.env['MEALPLAN_BOX'] ?? 'MEALPLAN');
|
||||||
await Hive.openBox<User>('USER_BOX');
|
await Hive.openBox<User>('USER_BOX');
|
||||||
//Hive.deleteFromDisk();
|
|
||||||
setupTodayBox();
|
setupTodayBox();
|
||||||
//mockDataForWholeWeek();
|
|
||||||
|
|
||||||
if (defaultTargetPlatform == TargetPlatform.android) {
|
if (defaultTargetPlatform == TargetPlatform.android) {
|
||||||
runApp(const AndroidApp());
|
runApp(const AndroidApp());
|
||||||
|
|
Loading…
Reference in New Issue