merge feature branch
commit
ae7f64ac1e
|
@ -1 +1 @@
|
||||||
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"path_provider_foundation","path":"C:\\\\Users\\\\FUCHSLAU\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_foundation-2.2.2\\\\","shared_darwin_source":true,"native_build":true,"dependencies":[]}],"android":[{"name":"path_provider_android","path":"C:\\\\Users\\\\FUCHSLAU\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_android-2.0.27\\\\","native_build":true,"dependencies":[]}],"macos":[{"name":"path_provider_foundation","path":"C:\\\\Users\\\\FUCHSLAU\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_foundation-2.2.2\\\\","shared_darwin_source":true,"native_build":true,"dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"C:\\\\Users\\\\FUCHSLAU\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_linux-2.1.10\\\\","native_build":false,"dependencies":[]}],"windows":[{"name":"path_provider_windows","path":"C:\\\\Users\\\\FUCHSLAU\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_windows-2.1.6\\\\","native_build":false,"dependencies":[]}],"web":[]},"dependencyGraph":[{"name":"path_provider","dependencies":["path_provider_android","path_provider_foundation","path_provider_linux","path_provider_windows"]},{"name":"path_provider_android","dependencies":[]},{"name":"path_provider_foundation","dependencies":[]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_windows","dependencies":[]}],"date_created":"2023-06-01 12:16:20.517755","version":"3.10.2"}
|
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"path_provider_foundation","path":"/Users/bogdan/.pub-cache/hosted/pub.dev/path_provider_foundation-2.2.2/","native_build":true,"dependencies":[]}],"android":[{"name":"path_provider_android","path":"/Users/bogdan/.pub-cache/hosted/pub.dev/path_provider_android-2.0.27/","native_build":true,"dependencies":[]}],"macos":[{"name":"path_provider_foundation","path":"/Users/bogdan/.pub-cache/hosted/pub.dev/path_provider_foundation-2.2.2/","native_build":true,"dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"/Users/bogdan/.pub-cache/hosted/pub.dev/path_provider_linux-2.1.10/","native_build":false,"dependencies":[]}],"windows":[{"name":"path_provider_windows","path":"/Users/bogdan/.pub-cache/hosted/pub.dev/path_provider_windows-2.1.6/","native_build":false,"dependencies":[]}],"web":[]},"dependencyGraph":[{"name":"path_provider","dependencies":["path_provider_android","path_provider_foundation","path_provider_linux","path_provider_windows"]},{"name":"path_provider_android","dependencies":[]},{"name":"path_provider_foundation","dependencies":[]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_windows","dependencies":[]}],"date_created":"2023-05-31 22:57:37.224562","version":"3.7.9"}
|
|
@ -9,11 +9,8 @@ class CardDataFoodComponent extends StatelessWidget {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Container(
|
return SizedBox(
|
||||||
height: 180,
|
height: 180,
|
||||||
decoration: const BoxDecoration(
|
|
||||||
color: Colors.pink,
|
|
||||||
borderRadius: BorderRadius.all(Radius.circular(16))),
|
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 8),
|
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 8),
|
||||||
child: SingleChildScrollView(
|
child: SingleChildScrollView(
|
||||||
|
@ -25,7 +22,15 @@ class CardDataFoodComponent extends StatelessWidget {
|
||||||
shrinkWrap: true,
|
shrinkWrap: true,
|
||||||
itemCount: foods.length,
|
itemCount: foods.length,
|
||||||
itemBuilder: (context, i) {
|
itemBuilder: (context, i) {
|
||||||
return CardFoodItemComponent(foods[i]);
|
return Column(
|
||||||
|
children: [
|
||||||
|
CardFoodItemComponent(foods[i]),
|
||||||
|
Divider(
|
||||||
|
color: Colors.grey.shade300,
|
||||||
|
thickness: 1.2,
|
||||||
|
)
|
||||||
|
],
|
||||||
|
);
|
||||||
})
|
})
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
import 'package:ernaehrung/android/config/statistics.dart';
|
import 'package:ernaehrung/android/config/statistics.dart';
|
||||||
|
import 'package:ernaehrung/android/models/user.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:hive/hive.dart';
|
||||||
import 'package:percent_indicator/circular_percent_indicator.dart';
|
import 'package:percent_indicator/circular_percent_indicator.dart';
|
||||||
|
|
||||||
class CircularLoadingComponent extends StatelessWidget {
|
class CircularLoadingComponent extends StatelessWidget {
|
||||||
const CircularLoadingComponent({Key? key}) : super(key: key);
|
CircularLoadingComponent({Key? key}) : super(key: key);
|
||||||
final int targetCaolries = 3500; // TODO get from user data
|
final int? targetCaolries = Hive.box<User>("USER_BOX").get("USER")?.kalorien;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {;
|
Widget build(BuildContext context) {;
|
||||||
|
@ -12,7 +14,7 @@ class CircularLoadingComponent extends StatelessWidget {
|
||||||
return ValueListenableBuilder(
|
return ValueListenableBuilder(
|
||||||
valueListenable: StatisticsService.instance.eatenCalories,
|
valueListenable: StatisticsService.instance.eatenCalories,
|
||||||
builder: (context, value, child) {
|
builder: (context, value, child) {
|
||||||
double progress = double.parse((value / targetCaolries).toStringAsFixed(1));
|
double progress = double.parse((value / targetCaolries!).toStringAsFixed(1));
|
||||||
progress = progress > 1.0 ? 1.0 : progress;
|
progress = progress > 1.0 ? 1.0 : progress;
|
||||||
|
|
||||||
return Column(
|
return Column(
|
||||||
|
@ -24,7 +26,7 @@ class CircularLoadingComponent extends StatelessWidget {
|
||||||
lineWidth: 5.0,
|
lineWidth: 5.0,
|
||||||
percent: progress,
|
percent: progress,
|
||||||
center: Text(
|
center: Text(
|
||||||
"$value/$targetCaolries kcal",
|
"$value/$targetCaolries Kcal",
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
),
|
),
|
||||||
progressColor: Colors.lightGreen,
|
progressColor: Colors.lightGreen,
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import 'package:ernaehrung/android/components/circular/circular_component.dart';
|
import 'package:ernaehrung/android/components/circular/circular_component.dart';
|
||||||
import 'package:ernaehrung/android/components/circular/line_circular_with_text_component.dart';
|
import 'package:ernaehrung/android/components/circular/line_circular_with_text_component.dart';
|
||||||
import 'package:ernaehrung/android/config/statistics.dart';
|
import 'package:ernaehrung/android/config/statistics.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
class StatisticsPercentage extends StatelessWidget {
|
class StatisticsPercentage extends StatelessWidget {
|
||||||
|
@ -11,7 +10,7 @@ class StatisticsPercentage extends StatelessWidget {
|
||||||
const StatisticsPercentage({Key? key}) : super(key: key);
|
const StatisticsPercentage({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {;
|
Widget build(BuildContext context) {
|
||||||
return Container(
|
return Container(
|
||||||
decoration:
|
decoration:
|
||||||
BoxDecoration(border: Border.all(width: 2.0, color: Colors.black)),
|
BoxDecoration(border: Border.all(width: 2.0, color: Colors.black)),
|
||||||
|
@ -20,10 +19,10 @@ class StatisticsPercentage extends StatelessWidget {
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
const Expanded(
|
Expanded(
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: EdgeInsets.symmetric(vertical: 0, horizontal: 8),
|
padding: const EdgeInsets.symmetric(vertical: 0, horizontal: 8),
|
||||||
child: FittedBox(
|
child: FittedBox(
|
||||||
child: CircularLoadingComponent(),
|
child: CircularLoadingComponent(),
|
||||||
),
|
),
|
||||||
|
@ -34,6 +33,7 @@ class StatisticsPercentage extends StatelessWidget {
|
||||||
child: ValueListenableBuilder<List<double>>(
|
child: ValueListenableBuilder<List<double>>(
|
||||||
valueListenable: StatisticsService.instance.ingredients,
|
valueListenable: StatisticsService.instance.ingredients,
|
||||||
builder: (context, value, child) {
|
builder: (context, value, child) {
|
||||||
|
print("value ${value}");
|
||||||
return Column(
|
return Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
children: [
|
children: [
|
||||||
|
|
|
@ -18,7 +18,7 @@ class StatisticsPercentComponent extends StatelessWidget {
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
Text("$eaten gegessen"),
|
Text("$eaten gegessen"),
|
||||||
const CircularLoadingComponent(),
|
CircularLoadingComponent(),
|
||||||
Text("$calorienBurned verbrannt"),
|
Text("$calorienBurned verbrannt"),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|
|
@ -216,7 +216,7 @@ class StatisticsService {
|
||||||
carbs += food.carbohydrateg;
|
carbs += food.carbohydrateg;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return [fat as double,protein as double,carbs as double];
|
return [fat.roundToDouble(),protein.roundToDouble(),carbs.roundToDouble()];
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateCalculationsAndNotfiyListenersForTodayStatistics(){
|
void updateCalculationsAndNotfiyListenersForTodayStatistics(){
|
||||||
|
@ -424,6 +424,7 @@ class StatisticsService {
|
||||||
DateTime now = DateTime.now();
|
DateTime now = DateTime.now();
|
||||||
return now.millisecondsSinceEpoch.toInt() ~/ 1000;
|
return now.millisecondsSinceEpoch.toInt() ~/ 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
showItems(){
|
showItems(){
|
||||||
print("Statistics.dart - showItems() - ITEMS");
|
print("Statistics.dart - showItems() - ITEMS");
|
||||||
//Hive.box(boxName).clear();
|
//Hive.box(boxName).clear();
|
||||||
|
@ -435,4 +436,6 @@ class StatisticsService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -35,7 +35,8 @@ class ProgressPage extends StatelessWidget {
|
||||||
valueListenable: StatisticsService.instance.dailyAverageForCurrentWeek,
|
valueListenable: StatisticsService.instance.dailyAverageForCurrentWeek,
|
||||||
builder: (context, value, child) {
|
builder: (context, value, child) {
|
||||||
return Container(
|
return Container(
|
||||||
height: 284,
|
height: 100,
|
||||||
|
width: 400,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
border: Border.all(),
|
border: Border.all(),
|
||||||
),
|
),
|
||||||
|
@ -195,4 +196,5 @@ class ProgressPage extends StatelessWidget {
|
||||||
show: false,
|
show: false,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue