bug fix
parent
c9d65c04f7
commit
8a3d6808a3
|
@ -7,6 +7,12 @@
|
|||
"packageUri": "lib/",
|
||||
"languageVersion": "2.17"
|
||||
},
|
||||
{
|
||||
"name": "adaptive_dialog",
|
||||
"rootUri": "file:///Users/bogdan/.pub-cache/hosted/pub.dev/adaptive_dialog-1.8.3+1",
|
||||
"packageUri": "lib/",
|
||||
"languageVersion": "2.17"
|
||||
},
|
||||
{
|
||||
"name": "analyzer",
|
||||
"rootUri": "file:///Users/bogdan/.pub-cache/hosted/pub.dev/analyzer-5.11.1",
|
||||
|
@ -19,6 +25,12 @@
|
|||
"packageUri": "lib/",
|
||||
"languageVersion": "2.16"
|
||||
},
|
||||
{
|
||||
"name": "animations",
|
||||
"rootUri": "file:///Users/bogdan/.pub-cache/hosted/pub.dev/animations-2.0.7",
|
||||
"packageUri": "lib/",
|
||||
"languageVersion": "2.12"
|
||||
},
|
||||
{
|
||||
"name": "args",
|
||||
"rootUri": "file:///Users/bogdan/.pub-cache/hosted/pub.dev/args-2.4.1",
|
||||
|
@ -49,6 +61,18 @@
|
|||
"packageUri": "lib/",
|
||||
"languageVersion": "2.17"
|
||||
},
|
||||
{
|
||||
"name": "bs_flutter_modal",
|
||||
"rootUri": "file:///Users/bogdan/.pub-cache/hosted/pub.dev/bs_flutter_modal-1.0.6",
|
||||
"packageUri": "lib/",
|
||||
"languageVersion": "2.12"
|
||||
},
|
||||
{
|
||||
"name": "bs_flutter_utils",
|
||||
"rootUri": "file:///Users/bogdan/.pub-cache/hosted/pub.dev/bs_flutter_utils-1.0.2",
|
||||
"packageUri": "lib/",
|
||||
"languageVersion": "2.12"
|
||||
},
|
||||
{
|
||||
"name": "build",
|
||||
"rootUri": "file:///Users/bogdan/.pub-cache/hosted/pub.dev/build-2.3.1",
|
||||
|
@ -157,6 +181,12 @@
|
|||
"packageUri": "lib/",
|
||||
"languageVersion": "2.19"
|
||||
},
|
||||
{
|
||||
"name": "dynamic_color",
|
||||
"rootUri": "file:///Users/bogdan/.pub-cache/hosted/pub.dev/dynamic_color-1.6.5",
|
||||
"packageUri": "lib/",
|
||||
"languageVersion": "2.16"
|
||||
},
|
||||
{
|
||||
"name": "empty_widget",
|
||||
"rootUri": "file:///Users/bogdan/.pub-cache/hosted/pub.dev/empty_widget-0.0.5",
|
||||
|
@ -313,6 +343,12 @@
|
|||
"packageUri": "lib/",
|
||||
"languageVersion": "2.12"
|
||||
},
|
||||
{
|
||||
"name": "intersperse",
|
||||
"rootUri": "file:///Users/bogdan/.pub-cache/hosted/pub.dev/intersperse-2.0.0",
|
||||
"packageUri": "lib/",
|
||||
"languageVersion": "2.12"
|
||||
},
|
||||
{
|
||||
"name": "intl",
|
||||
"rootUri": "file:///Users/bogdan/.pub-cache/hosted/pub.dev/intl-0.17.0",
|
||||
|
@ -349,6 +385,12 @@
|
|||
"packageUri": "lib/",
|
||||
"languageVersion": "2.18"
|
||||
},
|
||||
{
|
||||
"name": "macos_ui",
|
||||
"rootUri": "file:///Users/bogdan/.pub-cache/hosted/pub.dev/macos_ui-1.12.2",
|
||||
"packageUri": "lib/",
|
||||
"languageVersion": "2.17"
|
||||
},
|
||||
{
|
||||
"name": "matcher",
|
||||
"rootUri": "file:///Users/bogdan/.pub-cache/hosted/pub.dev/matcher-0.12.13",
|
||||
|
@ -626,7 +668,7 @@
|
|||
"languageVersion": "2.19"
|
||||
}
|
||||
],
|
||||
"generated": "2023-06-02T22:48:24.172799Z",
|
||||
"generated": "2023-06-08T14:59:35.567465Z",
|
||||
"generator": "pub",
|
||||
"generatorVersion": "2.19.6"
|
||||
}
|
||||
|
|
|
@ -2,6 +2,10 @@ _fe_analyzer_shared
|
|||
2.17
|
||||
file:///Users/bogdan/.pub-cache/hosted/pub.dev/_fe_analyzer_shared-59.0.0/
|
||||
file:///Users/bogdan/.pub-cache/hosted/pub.dev/_fe_analyzer_shared-59.0.0/lib/
|
||||
adaptive_dialog
|
||||
2.17
|
||||
file:///Users/bogdan/.pub-cache/hosted/pub.dev/adaptive_dialog-1.8.3+1/
|
||||
file:///Users/bogdan/.pub-cache/hosted/pub.dev/adaptive_dialog-1.8.3+1/lib/
|
||||
analyzer
|
||||
2.19
|
||||
file:///Users/bogdan/.pub-cache/hosted/pub.dev/analyzer-5.11.1/
|
||||
|
@ -10,6 +14,10 @@ animate_gradient
|
|||
2.16
|
||||
file:///Users/bogdan/.pub-cache/hosted/pub.dev/animate_gradient-0.0.2/
|
||||
file:///Users/bogdan/.pub-cache/hosted/pub.dev/animate_gradient-0.0.2/lib/
|
||||
animations
|
||||
2.12
|
||||
file:///Users/bogdan/.pub-cache/hosted/pub.dev/animations-2.0.7/
|
||||
file:///Users/bogdan/.pub-cache/hosted/pub.dev/animations-2.0.7/lib/
|
||||
args
|
||||
2.18
|
||||
file:///Users/bogdan/.pub-cache/hosted/pub.dev/args-2.4.1/
|
||||
|
@ -30,6 +38,14 @@ boolean_selector
|
|||
2.17
|
||||
file:///Users/bogdan/.pub-cache/hosted/pub.dev/boolean_selector-2.1.1/
|
||||
file:///Users/bogdan/.pub-cache/hosted/pub.dev/boolean_selector-2.1.1/lib/
|
||||
bs_flutter_modal
|
||||
2.12
|
||||
file:///Users/bogdan/.pub-cache/hosted/pub.dev/bs_flutter_modal-1.0.6/
|
||||
file:///Users/bogdan/.pub-cache/hosted/pub.dev/bs_flutter_modal-1.0.6/lib/
|
||||
bs_flutter_utils
|
||||
2.12
|
||||
file:///Users/bogdan/.pub-cache/hosted/pub.dev/bs_flutter_utils-1.0.2/
|
||||
file:///Users/bogdan/.pub-cache/hosted/pub.dev/bs_flutter_utils-1.0.2/lib/
|
||||
build
|
||||
2.17
|
||||
file:///Users/bogdan/.pub-cache/hosted/pub.dev/build-2.3.1/
|
||||
|
@ -102,6 +118,10 @@ dart_style
|
|||
2.19
|
||||
file:///Users/bogdan/.pub-cache/hosted/pub.dev/dart_style-2.3.1/
|
||||
file:///Users/bogdan/.pub-cache/hosted/pub.dev/dart_style-2.3.1/lib/
|
||||
dynamic_color
|
||||
2.16
|
||||
file:///Users/bogdan/.pub-cache/hosted/pub.dev/dynamic_color-1.6.5/
|
||||
file:///Users/bogdan/.pub-cache/hosted/pub.dev/dynamic_color-1.6.5/lib/
|
||||
empty_widget
|
||||
2.12
|
||||
file:///Users/bogdan/.pub-cache/hosted/pub.dev/empty_widget-0.0.5/
|
||||
|
@ -190,6 +210,10 @@ http_parser
|
|||
2.12
|
||||
file:///Users/bogdan/.pub-cache/hosted/pub.dev/http_parser-4.0.2/
|
||||
file:///Users/bogdan/.pub-cache/hosted/pub.dev/http_parser-4.0.2/lib/
|
||||
intersperse
|
||||
2.12
|
||||
file:///Users/bogdan/.pub-cache/hosted/pub.dev/intersperse-2.0.0/
|
||||
file:///Users/bogdan/.pub-cache/hosted/pub.dev/intersperse-2.0.0/lib/
|
||||
intl
|
||||
2.12
|
||||
file:///Users/bogdan/.pub-cache/hosted/pub.dev/intl-0.17.0/
|
||||
|
@ -214,6 +238,10 @@ logging
|
|||
2.18
|
||||
file:///Users/bogdan/.pub-cache/hosted/pub.dev/logging-1.1.1/
|
||||
file:///Users/bogdan/.pub-cache/hosted/pub.dev/logging-1.1.1/lib/
|
||||
macos_ui
|
||||
2.17
|
||||
file:///Users/bogdan/.pub-cache/hosted/pub.dev/macos_ui-1.12.2/
|
||||
file:///Users/bogdan/.pub-cache/hosted/pub.dev/macos_ui-1.12.2/lib/
|
||||
matcher
|
||||
2.18
|
||||
file:///Users/bogdan/.pub-cache/hosted/pub.dev/matcher-0.12.13/
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"fluttertoast","path":"/Users/bogdan/.pub-cache/hosted/pub.dev/fluttertoast-8.2.2/","native_build":true,"dependencies":[]},{"name":"path_provider_foundation","path":"/Users/bogdan/.pub-cache/hosted/pub.dev/path_provider_foundation-2.2.2/","native_build":true,"dependencies":[]}],"android":[{"name":"fluttertoast","path":"/Users/bogdan/.pub-cache/hosted/pub.dev/fluttertoast-8.2.2/","native_build":true,"dependencies":[]},{"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":[{"name":"fluttertoast","path":"/Users/bogdan/.pub-cache/hosted/pub.dev/fluttertoast-8.2.2/","dependencies":[]}]},"dependencyGraph":[{"name":"fluttertoast","dependencies":[]},{"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-06 22:44:47.468267","version":"3.7.9"}
|
||||
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"bs_flutter_modal","path":"/Users/bogdan/.pub-cache/hosted/pub.dev/bs_flutter_modal-1.0.6/","native_build":true,"dependencies":["bs_flutter_utils"]},{"name":"bs_flutter_utils","path":"/Users/bogdan/.pub-cache/hosted/pub.dev/bs_flutter_utils-1.0.2/","native_build":true,"dependencies":[]},{"name":"fluttertoast","path":"/Users/bogdan/.pub-cache/hosted/pub.dev/fluttertoast-8.2.2/","native_build":true,"dependencies":[]},{"name":"path_provider_foundation","path":"/Users/bogdan/.pub-cache/hosted/pub.dev/path_provider_foundation-2.2.2/","native_build":true,"dependencies":[]}],"android":[{"name":"bs_flutter_modal","path":"/Users/bogdan/.pub-cache/hosted/pub.dev/bs_flutter_modal-1.0.6/","native_build":true,"dependencies":["bs_flutter_utils"]},{"name":"bs_flutter_utils","path":"/Users/bogdan/.pub-cache/hosted/pub.dev/bs_flutter_utils-1.0.2/","native_build":true,"dependencies":[]},{"name":"dynamic_color","path":"/Users/bogdan/.pub-cache/hosted/pub.dev/dynamic_color-1.6.5/","native_build":true,"dependencies":[]},{"name":"fluttertoast","path":"/Users/bogdan/.pub-cache/hosted/pub.dev/fluttertoast-8.2.2/","native_build":true,"dependencies":[]},{"name":"path_provider_android","path":"/Users/bogdan/.pub-cache/hosted/pub.dev/path_provider_android-2.0.27/","native_build":true,"dependencies":[]}],"macos":[{"name":"dynamic_color","path":"/Users/bogdan/.pub-cache/hosted/pub.dev/dynamic_color-1.6.5/","native_build":true,"dependencies":[]},{"name":"macos_ui","path":"/Users/bogdan/.pub-cache/hosted/pub.dev/macos_ui-1.12.2/","native_build":true,"dependencies":[]},{"name":"path_provider_foundation","path":"/Users/bogdan/.pub-cache/hosted/pub.dev/path_provider_foundation-2.2.2/","native_build":true,"dependencies":[]}],"linux":[{"name":"dynamic_color","path":"/Users/bogdan/.pub-cache/hosted/pub.dev/dynamic_color-1.6.5/","native_build":true,"dependencies":[]},{"name":"path_provider_linux","path":"/Users/bogdan/.pub-cache/hosted/pub.dev/path_provider_linux-2.1.10/","native_build":false,"dependencies":[]}],"windows":[{"name":"dynamic_color","path":"/Users/bogdan/.pub-cache/hosted/pub.dev/dynamic_color-1.6.5/","native_build":true,"dependencies":[]},{"name":"path_provider_windows","path":"/Users/bogdan/.pub-cache/hosted/pub.dev/path_provider_windows-2.1.6/","native_build":false,"dependencies":[]}],"web":[{"name":"bs_flutter_modal","path":"/Users/bogdan/.pub-cache/hosted/pub.dev/bs_flutter_modal-1.0.6/","dependencies":["bs_flutter_utils"]},{"name":"bs_flutter_utils","path":"/Users/bogdan/.pub-cache/hosted/pub.dev/bs_flutter_utils-1.0.2/","dependencies":[]},{"name":"fluttertoast","path":"/Users/bogdan/.pub-cache/hosted/pub.dev/fluttertoast-8.2.2/","dependencies":[]}]},"dependencyGraph":[{"name":"bs_flutter_modal","dependencies":["bs_flutter_utils"]},{"name":"bs_flutter_utils","dependencies":[]},{"name":"dynamic_color","dependencies":[]},{"name":"fluttertoast","dependencies":[]},{"name":"macos_ui","dependencies":[]},{"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-13 16:03:42.984433","version":"3.7.9"}
|
|
@ -0,0 +1,301 @@
|
|||
import 'package:fl_chart/fl_chart.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../config/statistics.dart';
|
||||
import '../meal_page_text/secondary_big_text_component.dart';
|
||||
import '../meal_page_text/secondary_text_component.dart';
|
||||
import '../meal_page_text/title_component.dart';
|
||||
|
||||
class ChartComponent extends StatelessWidget {
|
||||
const ChartComponent({Key? key}) : super(key: key);
|
||||
|
||||
BarTouchData get barTouchData => BarTouchData(
|
||||
enabled: false,
|
||||
touchTooltipData: BarTouchTooltipData(
|
||||
tooltipBgColor: Colors.transparent,
|
||||
tooltipPadding: EdgeInsets.zero,
|
||||
tooltipMargin: 4,
|
||||
getTooltipItem: (
|
||||
BarChartGroupData group,
|
||||
int groupIndex,
|
||||
BarChartRodData rod,
|
||||
int rodIndex,
|
||||
) {
|
||||
return BarTooltipItem(
|
||||
rod.toY.round().toString(),
|
||||
const TextStyle(
|
||||
color: Colors.transparent,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
Widget getTitles(double value, TitleMeta meta) {
|
||||
const style = TextStyle(
|
||||
color: Colors.orange,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 14,
|
||||
);
|
||||
String text;
|
||||
switch (value.toInt()) {
|
||||
case 0:
|
||||
text = 'M';
|
||||
break;
|
||||
case 1:
|
||||
text = 'T';
|
||||
break;
|
||||
case 2:
|
||||
text = 'W';
|
||||
break;
|
||||
case 3:
|
||||
text = 'T';
|
||||
break;
|
||||
case 4:
|
||||
text = 'F';
|
||||
break;
|
||||
case 5:
|
||||
text = 'S';
|
||||
break;
|
||||
case 6:
|
||||
text = 'S';
|
||||
break;
|
||||
default:
|
||||
text = '';
|
||||
break;
|
||||
}
|
||||
return SideTitleWidget(
|
||||
axisSide: meta.axisSide,
|
||||
space: 4,
|
||||
child: Text(text, style: style),
|
||||
);
|
||||
}
|
||||
|
||||
FlTitlesData get titlesData => FlTitlesData(
|
||||
show: true,
|
||||
bottomTitles: AxisTitles(
|
||||
sideTitles: SideTitles(
|
||||
showTitles: true,
|
||||
reservedSize: 30,
|
||||
getTitlesWidget: getTitles,
|
||||
),
|
||||
),
|
||||
topTitles: AxisTitles(
|
||||
sideTitles: SideTitles(showTitles: false),
|
||||
),
|
||||
rightTitles: AxisTitles(
|
||||
sideTitles: SideTitles(
|
||||
showTitles: false,
|
||||
),
|
||||
),
|
||||
leftTitles: AxisTitles(
|
||||
sideTitles: SideTitles(
|
||||
showTitles: true,
|
||||
getTitlesWidget: (value, _) {
|
||||
// Return a custom widget for each axis value
|
||||
return Container(
|
||||
constraints:
|
||||
const BoxConstraints.tightFor(width: double.infinity),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(right: 3.0),
|
||||
// Adjust the margin value as needed
|
||||
child: FittedBox(
|
||||
fit: BoxFit.scaleDown,
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text(
|
||||
value.toInt().toString(),
|
||||
style: const TextStyle(
|
||||
color: Colors.orange,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
));
|
||||
|
||||
FlBorderData get borderData => FlBorderData(
|
||||
show: true, // Set to true to display the chart border
|
||||
border: const Border(
|
||||
bottom: BorderSide(color: Colors.black, width: 1),
|
||||
left:
|
||||
BorderSide(color: Colors.black, width: 1), // Hide the left border
|
||||
),
|
||||
);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return 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(
|
||||
children: [
|
||||
ValueListenableBuilder(
|
||||
valueListenable: StatisticsService
|
||||
.instance.dailyAverageForCurrentWeek,
|
||||
builder: (context, value, child) {
|
||||
return SizedBox(
|
||||
height: 100,
|
||||
width: 400,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const TitleComponent("Kalorien"),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
const SecondaryTextComponent(
|
||||
"Durchschnittlich"),
|
||||
SecondaryBigTextComponent(
|
||||
"${value.toString()} kcal/Tag"),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
ValueListenableBuilder(
|
||||
valueListenable:
|
||||
StatisticsService.instance.barChartData,
|
||||
builder: (context, value, child) {
|
||||
return SizedBox(
|
||||
height: 300,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 15,
|
||||
// Adjust the height of the legend as needed
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Container(
|
||||
margin: const EdgeInsets.symmetric(
|
||||
horizontal: 8.0),
|
||||
// Adjust the spacing between legend items
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
width: 12,
|
||||
height: 12,
|
||||
decoration: const BoxDecoration(
|
||||
color: Colors.red,
|
||||
// Use the color of the first bar rod for the legend item
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 4.0),
|
||||
// Adjust the spacing between the color indicator and the legend label
|
||||
const Text(
|
||||
'Frühstück',
|
||||
// Replace with your desired legend label
|
||||
style: TextStyle(
|
||||
fontSize:
|
||||
12), // Adjust the font size of the legend labels
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
margin: const EdgeInsets.symmetric(
|
||||
horizontal: 8.0),
|
||||
// Adjust the spacing between legend items
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
width: 12,
|
||||
height: 12,
|
||||
decoration: const BoxDecoration(
|
||||
color: Colors.green,
|
||||
// Use the color of the first bar rod for the legend item
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 4.0),
|
||||
// Adjust the spacing between the color indicator and the legend label
|
||||
const Text(
|
||||
'Mittagessen',
|
||||
// Replace with your desired legend label
|
||||
style: TextStyle(
|
||||
fontSize:
|
||||
12), // Adjust the font size of the legend labels
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
margin: const EdgeInsets.symmetric(
|
||||
horizontal: 8.0),
|
||||
// Adjust the spacing between legend items
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
width: 12,
|
||||
height: 12,
|
||||
decoration: const BoxDecoration(
|
||||
color: Colors.yellow,
|
||||
// Use the color of the first bar rod for the legend item
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 4.0),
|
||||
// Adjust the spacing between the color indicator and the legend label
|
||||
const Text(
|
||||
'Abendessen',
|
||||
// Replace with your desired legend label
|
||||
style: TextStyle(
|
||||
fontSize:
|
||||
12), // Adjust the font size of the legend labels
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
margin:
|
||||
const EdgeInsets.fromLTRB(0, 24, 0, 0),
|
||||
height: 250,
|
||||
child: BarChart(
|
||||
BarChartData(
|
||||
barTouchData: barTouchData,
|
||||
titlesData: titlesData,
|
||||
borderData: borderData,
|
||||
barGroups: value,
|
||||
gridData: FlGridData(show: false),
|
||||
alignment: BarChartAlignment.spaceAround,
|
||||
extraLinesData: ExtraLinesData(
|
||||
horizontalLines: [
|
||||
HorizontalLine(
|
||||
y: StatisticsService.instance.getCaloryTargetForOneDay(), // Specify the y-value where you want the line to be positioned
|
||||
color: Colors.black, // Change the color as per your requirement
|
||||
strokeWidth: 2, // Adjust the width as needed
|
||||
dashArray: [3, 2],
|
||||
label: HorizontalLineLabel(
|
||||
show: true,
|
||||
labelResolver: (x) => "Zielwert"
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../meal_page_text/days_component.dart';
|
||||
import '../meal_page_text/statistics_today_component.dart';
|
||||
|
||||
class RoundChartComponent extends StatelessWidget {
|
||||
const RoundChartComponent({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return 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(
|
||||
children: const [
|
||||
DaysMealPageComponent(),
|
||||
StatisticsPercentage(),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -1,7 +1,10 @@
|
|||
import 'package:ernaehrung/android/components/form/form_builder_text_field_component.dart';
|
||||
import 'package:ernaehrung/web/component/today.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_form_builder/flutter_form_builder.dart';
|
||||
import 'package:hive/hive.dart';
|
||||
import '../../../web/web_app.dart';
|
||||
import '../../models/form_builder.dart';
|
||||
import '../../models/user.dart';
|
||||
|
||||
|
@ -102,7 +105,7 @@ class _FormBuilderComponentState extends State<FormBuilderComponent> {
|
|||
shrinkWrap: true,
|
||||
itemBuilder: (context, index) {
|
||||
return FormBuilderTextFieldComponent(
|
||||
true, listOfTextField[index]);
|
||||
widget.lockTextFields, listOfTextField[index]);
|
||||
}),
|
||||
Container(
|
||||
margin:
|
||||
|
@ -151,16 +154,25 @@ class _FormBuilderComponentState extends State<FormBuilderComponent> {
|
|||
User(
|
||||
formKey.currentState?.fields['vorname']?.value,
|
||||
formKey.currentState?.fields['nachname']?.value,
|
||||
formKey.currentState?.fields['gewicht']?.value,
|
||||
formKey.currentState?.fields['groesse']?.value,
|
||||
formKey.currentState?.fields['alter']?.value,
|
||||
formKey
|
||||
.currentState?.fields['kalorien']?.value));
|
||||
int.parse(formKey.currentState?.fields['gewicht']?.value),
|
||||
int.parse(formKey.currentState?.fields['groesse']?.value),
|
||||
int.parse(formKey.currentState?.fields['alter']?.value),
|
||||
int.parse(formKey.currentState?.fields['kalorien']?.value)
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
if (kIsWeb) {
|
||||
Navigator.of(context).push(MaterialPageRoute(builder: (BuildContext context) => const HomeScreen()));
|
||||
}
|
||||
else{
|
||||
Future.delayed(
|
||||
const Duration(seconds: 2),
|
||||
() => Navigator.of(context).pushNamedAndRemoveUntil('/navigation', (Route<dynamic> route) => false));
|
||||
() => Navigator.of(context)
|
||||
.pushNamedAndRemoveUntil('/navigation', (Route<dynamic> route)
|
||||
=> false)
|
||||
);
|
||||
}
|
||||
},
|
||||
child: const Text("Eingaben bestätigen"),
|
||||
)),
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
||||
import 'package:hive/hive.dart';
|
||||
import 'package:hive_flutter/adapters.dart';
|
||||
|
||||
import '../config/statistics.dart';
|
||||
import 'card/card_component.dart';
|
||||
|
||||
class MealsComponent extends StatelessWidget {
|
||||
MealsComponent({Key? key}) : super(key: key);
|
||||
final List<Color> colors = [Colors.teal,Colors.red,Colors.green];
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ValueListenableBuilder(
|
||||
valueListenable: Hive.box(dotenv.env['MEALPLAN_BOX'] ?? 'MEALPLAN').listenable(),
|
||||
builder: (context, box, widget) {
|
||||
return ListView.builder(
|
||||
primary: false,
|
||||
shrinkWrap: true,
|
||||
itemCount: box.keys.length,
|
||||
itemBuilder: (context, i) {
|
||||
String mealTypeAsString = box.keyAt(i).toString();
|
||||
return CardComponent(
|
||||
mealTypeAsString,
|
||||
StatisticsService.instance.getMealsOfTodayByMealtype(mealTypeAsString),
|
||||
color: colors[i],
|
||||
);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
|
@ -1,3 +1,4 @@
|
|||
import 'package:ernaehrung/android/components/chart/round_chart.dart';
|
||||
import 'package:ernaehrung/android/components/meal_page_food_component.dart';
|
||||
import 'package:ernaehrung/android/components/meal_page_text/days_component.dart';
|
||||
import 'package:ernaehrung/android/components/meal_page_text/statistics_today_component.dart';
|
||||
|
@ -28,24 +29,10 @@ class _MealPlanState extends State<MealPlanPage> {
|
|||
width: double.infinity,
|
||||
height: double.infinity,
|
||||
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(
|
||||
children: const [
|
||||
DaysMealPageComponent(),
|
||||
StatisticsPercentage(),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
const MealPageStatisticsFoodComponent(),
|
||||
RoundChartComponent(),
|
||||
MealPageStatisticsFoodComponent(),
|
||||
],
|
||||
),
|
||||
)));
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import 'package:ernaehrung/android/components/chart/chart.dart';
|
||||
import 'package:ernaehrung/android/components/meal_page_text/secondary_big_text_component.dart';
|
||||
import 'package:ernaehrung/android/components/meal_page_text/secondary_text_component.dart';
|
||||
import 'package:ernaehrung/android/components/meal_page_text/title_component.dart';
|
||||
|
@ -26,174 +27,7 @@ class ProgressPage extends StatelessWidget {
|
|||
body: 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(
|
||||
children: [
|
||||
ValueListenableBuilder(
|
||||
valueListenable: StatisticsService
|
||||
.instance.dailyAverageForCurrentWeek,
|
||||
builder: (context, value, child) {
|
||||
return SizedBox(
|
||||
height: 100,
|
||||
width: 400,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const TitleComponent("Kalorien"),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
const SecondaryTextComponent(
|
||||
"Durchschnittlich"),
|
||||
SecondaryBigTextComponent(
|
||||
"${value.toString()} kcal/Tag"),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
ValueListenableBuilder(
|
||||
valueListenable:
|
||||
StatisticsService.instance.barChartData,
|
||||
builder: (context, value, child) {
|
||||
return SizedBox(
|
||||
height: 300,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 15,
|
||||
// Adjust the height of the legend as needed
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Container(
|
||||
margin: const EdgeInsets.symmetric(
|
||||
horizontal: 8.0),
|
||||
// Adjust the spacing between legend items
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
width: 12,
|
||||
height: 12,
|
||||
decoration: const BoxDecoration(
|
||||
color: Colors.red,
|
||||
// Use the color of the first bar rod for the legend item
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 4.0),
|
||||
// Adjust the spacing between the color indicator and the legend label
|
||||
const Text(
|
||||
'Frühstück',
|
||||
// Replace with your desired legend label
|
||||
style: TextStyle(
|
||||
fontSize:
|
||||
12), // Adjust the font size of the legend labels
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
margin: const EdgeInsets.symmetric(
|
||||
horizontal: 8.0),
|
||||
// Adjust the spacing between legend items
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
width: 12,
|
||||
height: 12,
|
||||
decoration: const BoxDecoration(
|
||||
color: Colors.green,
|
||||
// Use the color of the first bar rod for the legend item
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 4.0),
|
||||
// Adjust the spacing between the color indicator and the legend label
|
||||
const Text(
|
||||
'Mittagessen',
|
||||
// Replace with your desired legend label
|
||||
style: TextStyle(
|
||||
fontSize:
|
||||
12), // Adjust the font size of the legend labels
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
margin: const EdgeInsets.symmetric(
|
||||
horizontal: 8.0),
|
||||
// Adjust the spacing between legend items
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
width: 12,
|
||||
height: 12,
|
||||
decoration: const BoxDecoration(
|
||||
color: Colors.yellow,
|
||||
// Use the color of the first bar rod for the legend item
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 4.0),
|
||||
// Adjust the spacing between the color indicator and the legend label
|
||||
const Text(
|
||||
'Abendessen',
|
||||
// Replace with your desired legend label
|
||||
style: TextStyle(
|
||||
fontSize:
|
||||
12), // Adjust the font size of the legend labels
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
margin:
|
||||
const EdgeInsets.fromLTRB(0, 24, 0, 0),
|
||||
height: 250,
|
||||
child: BarChart(
|
||||
BarChartData(
|
||||
barTouchData: barTouchData,
|
||||
titlesData: titlesData,
|
||||
borderData: borderData,
|
||||
barGroups: value,
|
||||
gridData: FlGridData(show: false),
|
||||
alignment: BarChartAlignment.spaceAround,
|
||||
extraLinesData: ExtraLinesData(
|
||||
horizontalLines: [
|
||||
HorizontalLine(
|
||||
y: StatisticsService.instance.getCaloryTargetForOneDay(), // Specify the y-value where you want the line to be positioned
|
||||
color: Colors.black, // Change the color as per your requirement
|
||||
strokeWidth: 2, // Adjust the width as needed
|
||||
dashArray: [3, 2],
|
||||
label: HorizontalLineLabel(
|
||||
show: true,
|
||||
labelResolver: (x) => "Zielwert"
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
)),
|
||||
const ChartComponent(),
|
||||
Container(
|
||||
margin: const EdgeInsets.fromLTRB(0, 16, 0, 0),
|
||||
decoration: const BoxDecoration(
|
||||
|
@ -233,121 +67,4 @@ class ProgressPage extends StatelessWidget {
|
|||
),
|
||||
);
|
||||
}
|
||||
|
||||
BarTouchData get barTouchData => BarTouchData(
|
||||
enabled: false,
|
||||
touchTooltipData: BarTouchTooltipData(
|
||||
tooltipBgColor: Colors.transparent,
|
||||
tooltipPadding: EdgeInsets.zero,
|
||||
tooltipMargin: 4,
|
||||
getTooltipItem: (
|
||||
BarChartGroupData group,
|
||||
int groupIndex,
|
||||
BarChartRodData rod,
|
||||
int rodIndex,
|
||||
) {
|
||||
return BarTooltipItem(
|
||||
rod.toY.round().toString(),
|
||||
const TextStyle(
|
||||
color: Colors.transparent,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
Widget getTitles(double value, TitleMeta meta) {
|
||||
const style = TextStyle(
|
||||
color: Colors.orange,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 14,
|
||||
);
|
||||
String text;
|
||||
switch (value.toInt()) {
|
||||
case 0:
|
||||
text = 'M';
|
||||
break;
|
||||
case 1:
|
||||
text = 'T';
|
||||
break;
|
||||
case 2:
|
||||
text = 'W';
|
||||
break;
|
||||
case 3:
|
||||
text = 'T';
|
||||
break;
|
||||
case 4:
|
||||
text = 'F';
|
||||
break;
|
||||
case 5:
|
||||
text = 'S';
|
||||
break;
|
||||
case 6:
|
||||
text = 'S';
|
||||
break;
|
||||
default:
|
||||
text = '';
|
||||
break;
|
||||
}
|
||||
return SideTitleWidget(
|
||||
axisSide: meta.axisSide,
|
||||
space: 4,
|
||||
child: Text(text, style: style),
|
||||
);
|
||||
}
|
||||
|
||||
FlTitlesData get titlesData => FlTitlesData(
|
||||
show: true,
|
||||
bottomTitles: AxisTitles(
|
||||
sideTitles: SideTitles(
|
||||
showTitles: true,
|
||||
reservedSize: 30,
|
||||
getTitlesWidget: getTitles,
|
||||
),
|
||||
),
|
||||
topTitles: AxisTitles(
|
||||
sideTitles: SideTitles(showTitles: false),
|
||||
),
|
||||
rightTitles: AxisTitles(
|
||||
sideTitles: SideTitles(
|
||||
showTitles: false,
|
||||
),
|
||||
),
|
||||
leftTitles: AxisTitles(
|
||||
sideTitles: SideTitles(
|
||||
showTitles: true,
|
||||
getTitlesWidget: (value, _) {
|
||||
// Return a custom widget for each axis value
|
||||
return Container(
|
||||
constraints:
|
||||
const BoxConstraints.tightFor(width: double.infinity),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(right: 3.0),
|
||||
// Adjust the margin value as needed
|
||||
child: FittedBox(
|
||||
fit: BoxFit.scaleDown,
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text(
|
||||
value.toInt().toString(),
|
||||
style: const TextStyle(
|
||||
color: Colors.orange,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
));
|
||||
|
||||
FlBorderData get borderData => FlBorderData(
|
||||
show: true, // Set to true to display the chart border
|
||||
border: const Border(
|
||||
bottom: BorderSide(color: Colors.black, width: 1),
|
||||
left:
|
||||
BorderSide(color: Colors.black, width: 1), // Hide the left border
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import 'package:ernaehrung/android/components/card/card_component.dart';
|
||||
import 'package:ernaehrung/android/components/meals.dart';
|
||||
import 'package:ernaehrung/android/config/statistics.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
||||
|
@ -7,6 +8,7 @@ import 'package:hive_flutter/adapters.dart';
|
|||
class TodayPage extends StatefulWidget {
|
||||
final String title;
|
||||
final Color backgroundColor = const Color(0xff47a44b);
|
||||
|
||||
const TodayPage({Key? key, required this.title}) : super(key: key);
|
||||
|
||||
@override
|
||||
|
@ -14,27 +16,8 @@ class TodayPage extends StatefulWidget {
|
|||
}
|
||||
|
||||
class _TodayPageState extends State<TodayPage> {
|
||||
final List<Color> colors = [Colors.teal,Colors.red,Colors.green];
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
body: SingleChildScrollView(
|
||||
child: ValueListenableBuilder(
|
||||
valueListenable: Hive.box(dotenv.env['MEALPLAN_BOX'] ?? 'MEALPLAN').listenable(),
|
||||
builder: (context, box, widget) {
|
||||
return ListView.builder(
|
||||
primary: false,
|
||||
shrinkWrap: true,
|
||||
itemCount: box.keys.length,
|
||||
itemBuilder: (context, i) {
|
||||
String mealTypeAsString = box.keyAt(i).toString();
|
||||
return CardComponent(
|
||||
mealTypeAsString,
|
||||
StatisticsService.instance.getMealsOfTodayByMealtype(mealTypeAsString),
|
||||
color: colors[i],
|
||||
);
|
||||
});
|
||||
})));
|
||||
return Scaffold(body: SingleChildScrollView(child: MealsComponent()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
||||
import 'package:hive/hive.dart';
|
||||
|
||||
void storeUserData(String sname, String fname, int weight, int height, int calories) async {
|
||||
final userBox = Hive.box(dotenv.env['USER_BOX']!);
|
||||
userBox.put(dotenv.env['FIRST_NAME_FIELD']!, sname);
|
||||
userBox.put(dotenv.env['SECOND_NAME_FIELD']!, fname);
|
||||
userBox.put(dotenv.env['WEIGHT_FIELD']!, weight);
|
||||
userBox.put(dotenv.env['HEIGHT_FIELD']!, height);
|
||||
userBox.put(dotenv.env['CALORIES_FIELD']!, calories);
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
import 'package:flutter/cupertino.dart';
|
||||
import 'android/models/card.dart';
|
||||
|
||||
List<CardModel> essen = [
|
||||
CardModel('Haferflocken', 10, 1.1, 1.2),
|
||||
CardModel('Kekse', 20, 2.2, 2.3),
|
||||
CardModel('Bier', 30, 3.3, 3.4),
|
||||
];
|
||||
|
||||
Map<Map<Image, String>, List<CardModel>> cards = <Map<Image, String>, List<CardModel>>{
|
||||
{
|
||||
const Image(image: AssetImage('assets/images/fries.png')): 'Frühstück'
|
||||
}: essen,
|
||||
{
|
||||
const Image(image: AssetImage('assets/images/ice.png')): 'Mittagessen'
|
||||
}: essen,
|
||||
{
|
||||
const Image(image: AssetImage('assets/images/tea.png')): 'Abendessen'
|
||||
}: essen
|
||||
};
|
|
@ -1,18 +0,0 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
class HeaderButton extends StatelessWidget {
|
||||
final String buttonText;
|
||||
final Widget page;
|
||||
|
||||
const HeaderButton(this.buttonText, this.page, {super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ElevatedButton(onPressed: (){
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) => page),
|
||||
);
|
||||
}, child: Text(buttonText));
|
||||
}
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
import 'package:ernaehrung/web/component/header_button_component.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
|
||||
class HeaderComponentWeb extends StatelessWidget {
|
||||
HeaderComponentWeb({Key? key}) : super(key: key);
|
||||
|
||||
final List<HeaderData> headerButtons = [
|
||||
HeaderData("Heute", const Placeholder()),
|
||||
HeaderData("Fortschritt", const Placeholder()),
|
||||
HeaderData("Mahlzeitplan", const Placeholder())
|
||||
];
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: List.generate(headerButtons.length, (index) =>
|
||||
HeaderButton(headerButtons[index].buttonText, headerButtons[index].page))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class HeaderData{
|
||||
final String buttonText;
|
||||
final Widget page;
|
||||
|
||||
HeaderData(this.buttonText, this.page);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'HeaderData{route: $page, buttonText: $buttonText}';
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,60 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../functions/responsive.dart';
|
||||
|
||||
class NavigationBarComponent extends StatelessWidget {
|
||||
NavigationBarComponent({Key? key}) : super(key: key);
|
||||
|
||||
final List<Widget> navItems = [
|
||||
ElevatedButton(onPressed: (){}, child: const Text("Heute")),
|
||||
ElevatedButton(onPressed: (){}, child: const Text("Gesamtübersicht")),
|
||||
ElevatedButton(onPressed: (){}, child: const Text("Statistics"))
|
||||
];
|
||||
|
||||
Widget responsiveNavigation(BuildContext context){
|
||||
final width = (isDesktop(context) || isTablet(context))
|
||||
? MediaQuery.of(context).size.width * 0.8
|
||||
: MediaQuery.of(context).size.width * 1;
|
||||
|
||||
if (isDesktop(context) || isTablet(context)){
|
||||
return Container(
|
||||
width: width,
|
||||
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 0),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: navItems
|
||||
),
|
||||
);
|
||||
}else {
|
||||
return Container(
|
||||
width: width,
|
||||
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 0),
|
||||
child: Column(
|
||||
children: [
|
||||
ListView.builder(
|
||||
shrinkWrap: true,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
itemCount: navItems.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return Container(
|
||||
width: MediaQuery.of(context).size.width * 0.1,
|
||||
margin: const EdgeInsets.symmetric(
|
||||
vertical: 8,
|
||||
horizontal: 8
|
||||
),
|
||||
child: navItems[index],
|
||||
);
|
||||
}
|
||||
),
|
||||
]
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return responsiveNavigation(context);
|
||||
}
|
||||
}
|
|
@ -1,45 +0,0 @@
|
|||
import 'package:ernaehrung/android/components/statistics_circular_indicator_component.dart';
|
||||
import 'package:ernaehrung/android/config/cast_helper.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:hive_flutter/adapters.dart';
|
||||
import '../../android/components/card_component.dart';
|
||||
import '../../android/components/diet_chart_component.dart';
|
||||
|
||||
class SectionComponent extends StatelessWidget {
|
||||
const SectionComponent({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
const StatisticsPercentComponent(
|
||||
calorienLeftPercent: 0,
|
||||
eaten: 0,
|
||||
calorienBurned: 0,
|
||||
calorienLeft: 0,
|
||||
),
|
||||
DietChatComponent(1500),
|
||||
ValueListenableBuilder(
|
||||
valueListenable: Hive.box("TODAY").listenable(),
|
||||
builder: (context, box, widget) {
|
||||
return ListView.builder(
|
||||
primary: false,
|
||||
shrinkWrap: true,
|
||||
itemCount: box.keys.length,
|
||||
itemBuilder: (context, i) {
|
||||
if (box.keyAt(i).toString() == "DATE") {
|
||||
return const SizedBox.shrink();
|
||||
} else {
|
||||
return CardComponent(
|
||||
eatingMealName: box.keyAt(i).toString(),
|
||||
selectedMeal: castDynamicToListFood(box.getAt(i)),
|
||||
);
|
||||
}
|
||||
});
|
||||
}),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
import 'package:ernaehrung/android/components/chart/chart.dart';
|
||||
import 'package:ernaehrung/android/components/chart/round_chart.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:hive/hive.dart';
|
||||
|
||||
import '../../android/components/form/form_builder.dart';
|
||||
import '../../android/components/meals.dart';
|
||||
import '../../android/models/user.dart';
|
||||
import '../functions/responsive.dart';
|
||||
|
||||
class CommonWebComponent extends StatefulWidget {
|
||||
const CommonWebComponent({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<CommonWebComponent> createState() => _CommonWebComponentState();
|
||||
}
|
||||
|
||||
class _CommonWebComponentState extends State<CommonWebComponent> {
|
||||
Widget widgetResponsiveWidget(context) {
|
||||
return (isDesktop(context) || isTablet(context))
|
||||
? responsiveTabletAndWebComponent()
|
||||
: responsiveMobileComponent();
|
||||
}
|
||||
|
||||
Widget responsiveTabletAndWebComponent() {
|
||||
return const Placeholder();
|
||||
}
|
||||
|
||||
Widget responsiveMobileComponent() {
|
||||
final box = Hive.box<User>("USER_BOX");
|
||||
return box.isEmpty
|
||||
? const FormBuilderComponent(lockTextFields: false)
|
||||
: SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
const RoundChartComponent(),
|
||||
const ChartComponent(),
|
||||
MealsComponent()
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return widgetResponsiveWidget(context);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
bool isDesktop(BuildContext context) =>
|
||||
MediaQuery.of(context).size.width >= 1028;
|
||||
|
||||
bool isTablet(BuildContext context) =>
|
||||
MediaQuery.of(context).size.width >= 768 &&
|
||||
MediaQuery.of(context).size.width <= 1027;
|
||||
|
||||
bool isMobile(BuildContext context) =>
|
||||
MediaQuery.of(context).size.width <= 767;
|
|
@ -1,31 +0,0 @@
|
|||
import 'package:ernaehrung/web/component/header_component.dart';
|
||||
import 'package:ernaehrung/web/component/section_component.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class MobileScreen extends StatelessWidget {
|
||||
const MobileScreen({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final screenWidth = MediaQuery.of(context).size.width;
|
||||
return SizedBox(
|
||||
width: screenWidth,
|
||||
height: screenWidth,
|
||||
child: SingleChildScrollView(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8),
|
||||
child: Column(
|
||||
children: [
|
||||
HeaderComponentWeb(),
|
||||
Container(
|
||||
margin: const EdgeInsets.fromLTRB(0, 24, 0, 0),
|
||||
child: const Center(
|
||||
child: SectionComponent()
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
));
|
||||
}
|
||||
}
|
|
@ -1,4 +1,5 @@
|
|||
import 'package:ernaehrung/web/mobile.dart';
|
||||
import 'package:ernaehrung/web/component/navigation.dart';
|
||||
import 'package:ernaehrung/web/component/today.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:sizer/sizer.dart';
|
||||
|
||||
|
@ -28,34 +29,18 @@ class HomeScreen extends StatefulWidget {
|
|||
}
|
||||
|
||||
class _HomeScreenState extends State<HomeScreen> {
|
||||
|
||||
bool isDesktop(BuildContext context) => MediaQuery.of(context).size.width >= 1028;
|
||||
bool isTablet(BuildContext context) =>
|
||||
MediaQuery.of(context).size.width >= 768 && MediaQuery.of(context).size.width <= 1027;
|
||||
bool isMobile(BuildContext context) => MediaQuery.of(context).size.width <= 767;
|
||||
|
||||
Widget getDeviceType(context){
|
||||
if(isDesktop(context)){
|
||||
return const Text("Desktop");
|
||||
}else if(isTablet(context)){
|
||||
return const Text("Tablet");
|
||||
}else if(isMobile(context)){
|
||||
return const MobileScreen();
|
||||
}
|
||||
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
body: Row(
|
||||
children: [
|
||||
getDeviceType(context),
|
||||
],
|
||||
)
|
||||
body: SizedBox(
|
||||
width: MediaQuery.of(context).size.width * 1,
|
||||
height: MediaQuery.of(context).size.height * 1,
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [NavigationBarComponent(), const CommonWebComponent()],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -6,6 +6,10 @@
|
|||
|
||||
#include "generated_plugin_registrant.h"
|
||||
|
||||
#include <dynamic_color/dynamic_color_plugin.h>
|
||||
|
||||
void fl_register_plugins(FlPluginRegistry* registry) {
|
||||
g_autoptr(FlPluginRegistrar) dynamic_color_registrar =
|
||||
fl_plugin_registry_get_registrar_for_plugin(registry, "DynamicColorPlugin");
|
||||
dynamic_color_plugin_register_with_registrar(dynamic_color_registrar);
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#
|
||||
|
||||
list(APPEND FLUTTER_PLUGIN_LIST
|
||||
dynamic_color
|
||||
)
|
||||
|
||||
list(APPEND FLUTTER_FFI_PLUGIN_LIST
|
||||
|
|
|
@ -5,8 +5,12 @@
|
|||
import FlutterMacOS
|
||||
import Foundation
|
||||
|
||||
import dynamic_color
|
||||
import macos_ui
|
||||
import path_provider_foundation
|
||||
|
||||
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
||||
DynamicColorPlugin.register(with: registry.registrar(forPlugin: "DynamicColorPlugin"))
|
||||
MacOSUiPlugin.register(with: registry.registrar(forPlugin: "MacOSUiPlugin"))
|
||||
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
|
||||
}
|
||||
|
|
56
pubspec.lock
56
pubspec.lock
|
@ -9,6 +9,14 @@ packages:
|
|||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "59.0.0"
|
||||
adaptive_dialog:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: adaptive_dialog
|
||||
sha256: "570a517946abc252b79ca09ed95c7e397ccf669b052c76173448b981a3c4b207"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.8.3+1"
|
||||
analyzer:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -25,6 +33,14 @@ packages:
|
|||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.0.2"
|
||||
animations:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: animations
|
||||
sha256: fe8a6bdca435f718bb1dc8a11661b2c22504c6da40ef934cee8327ed77934164
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.0.7"
|
||||
args:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -65,6 +81,22 @@ packages:
|
|||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.1"
|
||||
bs_flutter_modal:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: bs_flutter_modal
|
||||
sha256: a29ee8c83df35e6c861b58f1f175de6118408583357cdb9bdc5597565b49a612
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.0.6"
|
||||
bs_flutter_utils:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: bs_flutter_utils
|
||||
sha256: "4d405d1a2ac8287dacb51b464ca2496a785334c75a49263e914038d600ed25ff"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.0.2"
|
||||
build:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -209,6 +241,14 @@ packages:
|
|||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.3.1"
|
||||
dynamic_color:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: dynamic_color
|
||||
sha256: "74dff1435a695887ca64899b8990004f8d1232b0e84bfc4faa1fdda7c6f57cc1"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.6.5"
|
||||
empty_widget:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
@ -405,6 +445,14 @@ packages:
|
|||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "4.0.2"
|
||||
intersperse:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: intersperse
|
||||
sha256: "2f8a905c96f6cbba978644a3d5b31b8d86ddc44917662df7d27a61f3df66a576"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.0.0"
|
||||
intl:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -453,6 +501,14 @@ packages:
|
|||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.1.1"
|
||||
macos_ui:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: macos_ui
|
||||
sha256: "57208eec8180656acd379e1c754e9b6d8830f32a020b94571ae2188f8112075b"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.12.2"
|
||||
matcher:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
|
@ -51,6 +51,8 @@ dependencies:
|
|||
form_builder_validators: ^8.0.0
|
||||
fluttertoast: ^8.0.7
|
||||
flutter_profile_picture: ^2.0.0
|
||||
bs_flutter_modal: ^1.0.6
|
||||
adaptive_dialog: ^1.8.3+1
|
||||
|
||||
|
||||
dev_dependencies:
|
||||
|
|
Loading…
Reference in New Issue