From 8a3d6808a37fd328260d83c7713a638506e642c4 Mon Sep 17 00:00:00 2001 From: bogdan <1926167@stud.hs-mannheim.de> Date: Fri, 16 Jun 2023 08:34:41 +0200 Subject: [PATCH] bug fix --- .dart_tool/package_config.json | 44 ++- .dart_tool/package_config_subset | 28 ++ .flutter-plugins-dependencies | 2 +- lib/android/components/chart/chart.dart | 301 ++++++++++++++++++ lib/android/components/chart/round_chart.dart | 27 ++ lib/android/components/form/form_builder.dart | 30 +- lib/android/components/meals.dart | 33 ++ .../pages/nav_pages/meal_plan_page.dart | 21 +- .../pages/nav_pages/progress_page.dart | 287 +---------------- lib/android/pages/nav_pages/today_page.dart | 23 +- lib/functions/db_crud.dart | 0 lib/functions/welcome_crud.dart | 11 - lib/mockdata.dart | 20 -- .../component/header_button_component.dart | 18 -- lib/web/component/header_component.dart | 35 -- lib/web/component/navigation.dart | 60 ++++ lib/web/component/section_component.dart | 45 --- lib/web/component/today.dart | 48 +++ lib/web/functions/responsive.dart | 11 + lib/web/mobile.dart | 31 -- lib/web/web_app.dart | 41 +-- linux/flutter/generated_plugin_registrant.cc | 4 + linux/flutter/generated_plugins.cmake | 1 + macos/Flutter/GeneratedPluginRegistrant.swift | 4 + pubspec.lock | 56 ++++ pubspec.yaml | 2 + 26 files changed, 662 insertions(+), 521 deletions(-) create mode 100644 lib/android/components/chart/chart.dart create mode 100644 lib/android/components/chart/round_chart.dart create mode 100644 lib/android/components/meals.dart delete mode 100644 lib/functions/db_crud.dart delete mode 100644 lib/functions/welcome_crud.dart delete mode 100644 lib/mockdata.dart delete mode 100644 lib/web/component/header_button_component.dart delete mode 100644 lib/web/component/header_component.dart create mode 100644 lib/web/component/navigation.dart delete mode 100644 lib/web/component/section_component.dart create mode 100644 lib/web/component/today.dart create mode 100644 lib/web/functions/responsive.dart delete mode 100644 lib/web/mobile.dart diff --git a/.dart_tool/package_config.json b/.dart_tool/package_config.json index fe9846a..10d3553 100644 --- a/.dart_tool/package_config.json +++ b/.dart_tool/package_config.json @@ -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" } diff --git a/.dart_tool/package_config_subset b/.dart_tool/package_config_subset index 8467c94..40f0f42 100644 --- a/.dart_tool/package_config_subset +++ b/.dart_tool/package_config_subset @@ -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/ diff --git a/.flutter-plugins-dependencies b/.flutter-plugins-dependencies index 915bca8..7359932 100644 --- a/.flutter-plugins-dependencies +++ b/.flutter-plugins-dependencies @@ -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"} \ No newline at end of file +{"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"} \ No newline at end of file diff --git a/lib/android/components/chart/chart.dart b/lib/android/components/chart/chart.dart new file mode 100644 index 0000000..cd3c7a8 --- /dev/null +++ b/lib/android/components/chart/chart.dart @@ -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" + ) + ), + ], + ), + ), + ), + ), + ], + ), + ); + }, + ), + ], + ), + )); + } +} diff --git a/lib/android/components/chart/round_chart.dart b/lib/android/components/chart/round_chart.dart new file mode 100644 index 0000000..4ae6a29 --- /dev/null +++ b/lib/android/components/chart/round_chart.dart @@ -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(), + ], + ), + ), + ); + } +} diff --git a/lib/android/components/form/form_builder.dart b/lib/android/components/form/form_builder.dart index a3c89e4..7efd175 100644 --- a/lib/android/components/form/form_builder.dart +++ b/lib/android/components/form/form_builder.dart @@ -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 { shrinkWrap: true, itemBuilder: (context, index) { return FormBuilderTextFieldComponent( - true, listOfTextField[index]); + widget.lockTextFields, listOfTextField[index]); }), Container( margin: @@ -151,16 +154,25 @@ class _FormBuilderComponentState extends State { 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) + )); } - Future.delayed( - const Duration(seconds: 2), - () => Navigator.of(context).pushNamedAndRemoveUntil('/navigation', (Route route) => false)); + + 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 route) + => false) + ); + } }, child: const Text("Eingaben bestätigen"), )), diff --git a/lib/android/components/meals.dart b/lib/android/components/meals.dart new file mode 100644 index 0000000..a0958e3 --- /dev/null +++ b/lib/android/components/meals.dart @@ -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 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], + ); + }); + }); + } +} diff --git a/lib/android/pages/nav_pages/meal_plan_page.dart b/lib/android/pages/nav_pages/meal_plan_page.dart index ecc3411..c8cece4 100644 --- a/lib/android/pages/nav_pages/meal_plan_page.dart +++ b/lib/android/pages/nav_pages/meal_plan_page.dart @@ -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'; @@ -29,23 +30,9 @@ class _MealPlanState extends State { 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(), + children: const [ + RoundChartComponent(), + MealPageStatisticsFoodComponent(), ], ), ))); diff --git a/lib/android/pages/nav_pages/progress_page.dart b/lib/android/pages/nav_pages/progress_page.dart index a19aafb..71284ae 100644 --- a/lib/android/pages/nav_pages/progress_page.dart +++ b/lib/android/pages/nav_pages/progress_page.dart @@ -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 - ), - ); } diff --git a/lib/android/pages/nav_pages/today_page.dart b/lib/android/pages/nav_pages/today_page.dart index a653411..4db409f 100644 --- a/lib/android/pages/nav_pages/today_page.dart +++ b/lib/android/pages/nav_pages/today_page.dart @@ -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 { - final List 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())); } } diff --git a/lib/functions/db_crud.dart b/lib/functions/db_crud.dart deleted file mode 100644 index e69de29..0000000 diff --git a/lib/functions/welcome_crud.dart b/lib/functions/welcome_crud.dart deleted file mode 100644 index 99f147c..0000000 --- a/lib/functions/welcome_crud.dart +++ /dev/null @@ -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); -} \ No newline at end of file diff --git a/lib/mockdata.dart b/lib/mockdata.dart deleted file mode 100644 index 6c11fb1..0000000 --- a/lib/mockdata.dart +++ /dev/null @@ -1,20 +0,0 @@ -import 'package:flutter/cupertino.dart'; -import 'android/models/card.dart'; - -List essen = [ - CardModel('Haferflocken', 10, 1.1, 1.2), - CardModel('Kekse', 20, 2.2, 2.3), - CardModel('Bier', 30, 3.3, 3.4), -]; - -Map, List> cards = , List>{ - { - 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 -}; \ No newline at end of file diff --git a/lib/web/component/header_button_component.dart b/lib/web/component/header_button_component.dart deleted file mode 100644 index 9dbb8ae..0000000 --- a/lib/web/component/header_button_component.dart +++ /dev/null @@ -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)); - } -} diff --git a/lib/web/component/header_component.dart b/lib/web/component/header_component.dart deleted file mode 100644 index 784d3e7..0000000 --- a/lib/web/component/header_component.dart +++ /dev/null @@ -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 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}'; - } - - -} diff --git a/lib/web/component/navigation.dart b/lib/web/component/navigation.dart new file mode 100644 index 0000000..aa9e4b4 --- /dev/null +++ b/lib/web/component/navigation.dart @@ -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 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); + } +} diff --git a/lib/web/component/section_component.dart b/lib/web/component/section_component.dart deleted file mode 100644 index 17c96a7..0000000 --- a/lib/web/component/section_component.dart +++ /dev/null @@ -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)), - ); - } - }); - }), - ], - ), - ); - } -} diff --git a/lib/web/component/today.dart b/lib/web/component/today.dart new file mode 100644 index 0000000..61a27e6 --- /dev/null +++ b/lib/web/component/today.dart @@ -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 createState() => _CommonWebComponentState(); +} + +class _CommonWebComponentState extends State { + Widget widgetResponsiveWidget(context) { + return (isDesktop(context) || isTablet(context)) + ? responsiveTabletAndWebComponent() + : responsiveMobileComponent(); + } + + Widget responsiveTabletAndWebComponent() { + return const Placeholder(); + } + + Widget responsiveMobileComponent() { + final box = Hive.box("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); + } +} diff --git a/lib/web/functions/responsive.dart b/lib/web/functions/responsive.dart new file mode 100644 index 0000000..17dc73f --- /dev/null +++ b/lib/web/functions/responsive.dart @@ -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; \ No newline at end of file diff --git a/lib/web/mobile.dart b/lib/web/mobile.dart deleted file mode 100644 index d522d38..0000000 --- a/lib/web/mobile.dart +++ /dev/null @@ -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() - ), - ) - ], - ), - ), - )); - } -} diff --git a/lib/web/web_app.dart b/lib/web/web_app.dart index fc02f0c..1c2d50a 100644 --- a/lib/web/web_app.dart +++ b/lib/web/web_app.dart @@ -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'; @@ -13,7 +14,7 @@ class WebApp extends StatelessWidget { debugShowCheckedModeBanner: false, title: 'Sizer', theme: ThemeData.light(), - home: const HomeScreen() , + home: const HomeScreen(), ); }, ); @@ -28,34 +29,18 @@ class HomeScreen extends StatefulWidget { } class _HomeScreenState extends State { - - 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), - ], - ) + return Scaffold( + body: SizedBox( + width: MediaQuery.of(context).size.width * 1, + height: MediaQuery.of(context).size.height * 1, + child: SingleChildScrollView( + child: Column( + children: [NavigationBarComponent(), const CommonWebComponent()], + ), + ), + ), ); } } - - diff --git a/linux/flutter/generated_plugin_registrant.cc b/linux/flutter/generated_plugin_registrant.cc index e71a16d..675b719 100644 --- a/linux/flutter/generated_plugin_registrant.cc +++ b/linux/flutter/generated_plugin_registrant.cc @@ -6,6 +6,10 @@ #include "generated_plugin_registrant.h" +#include 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); } diff --git a/linux/flutter/generated_plugins.cmake b/linux/flutter/generated_plugins.cmake index 2e1de87..3e303c1 100644 --- a/linux/flutter/generated_plugins.cmake +++ b/linux/flutter/generated_plugins.cmake @@ -3,6 +3,7 @@ # list(APPEND FLUTTER_PLUGIN_LIST + dynamic_color ) list(APPEND FLUTTER_FFI_PLUGIN_LIST diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift index e777c67..4d88d02 100644 --- a/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/macos/Flutter/GeneratedPluginRegistrant.swift @@ -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")) } diff --git a/pubspec.lock b/pubspec.lock index f8d440b..05f1185 100644 --- a/pubspec.lock +++ b/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: diff --git a/pubspec.yaml b/pubspec.yaml index ecec372..9ea8f48 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -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: