From 54a61fa585b2d6528368f556d94a3c3f7e863e96 Mon Sep 17 00:00:00 2001 From: bossanyit Date: Sun, 12 Dec 2021 16:17:47 +0100 Subject: [PATCH] WT 1.1.25+3 flutter 2.8, activate training plan --- i18n/en.json | 2 +- i18n/hu.json | 2 +- ios/Podfile.lock | 107 ++- ios/Runner.xcodeproj/project.pbxproj | 8 +- lib/animations/test_progress_animation.dart | 1 - .../development_by_muscle_bloc.dart | 1 - lib/bloc/exercise_new/exercise_new_bloc.dart | 2 - lib/bloc/menu/menu_bloc.dart | 1 - lib/bloc/sales/sales_bloc.dart | 2 +- lib/bloc/settings/settings_bloc.dart | 80 +-- .../training_evaluation_bloc.dart | 32 +- lib/bloc/training_log/training_log_bloc.dart | 8 +- .../training_plan/training_plan_bloc.dart | 607 +++++++++++------- .../training_plan/training_plan_event.dart | 31 +- .../dropdown_search/dropdown_search.dart | 2 - lib/library/dropdown_search/popup_menu.dart | 1 - .../gradient_bottom_navigation_bar.dart | 1 - lib/library/radar_chart.dart | 1 - lib/library/super_tooltip.dart | 1 - lib/main.dart | 33 +- lib/model/cache.dart | 2 +- lib/model/customer_training_plan_details.dart | 8 + lib/repository/customer_repository.dart | 6 + lib/repository/evaluation_repository.dart | 1 - lib/repository/exercise_plan_repository.dart | 2 +- lib/repository/training_plan_repository.dart | 121 +++- lib/service/api.dart | 21 +- .../customer_exercise_device_service.dart | 2 +- lib/service/customer_service.dart | 2 +- lib/service/exercise_device_service.dart | 2 +- lib/service/exercise_plan_service.dart | 2 +- lib/service/exercise_result_service.dart | 2 +- lib/service/exercise_service.dart | 2 +- lib/service/exercise_tree_service.dart | 2 +- lib/service/exercise_type_service.dart | 2 +- lib/service/package_service.dart | 2 +- lib/service/product_service.dart | 2 +- lib/service/property_service.dart | 2 +- lib/service/purchase_service.dart | 2 +- lib/service/sport_service.dart | 2 +- lib/service/tracking_service.dart | 2 +- lib/service/training_plan_service.dart | 2 +- lib/util/app_localization.dart | 1 - lib/util/common.dart | 1 - lib/util/track.dart | 4 +- lib/view/account.dart | 2 +- lib/view/customer_bodytype_animation.dart | 2 - lib/view/customer_exercise_device.dart | 1 - lib/view/customer_fitness_page.dart | 3 - lib/view/customer_goal_page.dart | 1 - lib/view/customer_height_page.dart | 2 - lib/view/customer_modify_page.dart | 2 - lib/view/customer_sex_page.dart | 2 - lib/view/customer_weight_page.dart | 2 - lib/view/evaluation_page.dart | 1 - lib/view/exercise_control_page.dart | 1 - lib/view/faq_page.dart | 1 - lib/view/login.dart | 1 - lib/view/menu_page.dart | 1 - lib/view/mydevelopment_log.dart | 6 +- lib/view/mydevelopment_muscle_page.dart | 2 - lib/view/mydevelopment_page.dart | 1 - lib/view/mydevelopment_sizes_page.dart | 2 - lib/view/registration.dart | 1 - lib/view/reset_password.dart | 1 - lib/view/sales_page.dart | 2 - lib/view/settings.dart | 1 - lib/view/training_plan_activate_page.dart | 1 - lib/view/training_plan_custom.dart | 4 +- lib/view/training_plan_custom_add.dart | 3 - lib/view/training_plan_execute.dart | 148 +++-- lib/view/training_plan_exercise.dart | 4 +- lib/view/training_plans_page.dart | 1 - lib/widgets/app_bar.dart | 1 - lib/widgets/app_bar_min.dart | 1 - lib/widgets/app_bar_progress.dart | 1 - lib/widgets/bmi_widget.dart | 2 - lib/widgets/bmr_widget.dart | 2 - lib/widgets/bottom_nav.dart | 2 - lib/widgets/dialog_html.dart | 1 - lib/widgets/exercise_save.dart | 1 - lib/widgets/home.dart | 2 - lib/widgets/image_button.dart | 1 - lib/widgets/loading.dart | 1 - lib/widgets/menu_image.dart | 1 - lib/widgets/menu_page_widget.dart | 16 +- lib/widgets/size_widget.dart | 2 - lib/widgets/treeview_parent_widget.dart | 1 - lib/widgets/tutorial_widget.dart | 6 +- pubspec.lock | 190 ++++-- pubspec.yaml | 32 +- test/widget_test.db.dart | 7 +- test/widget_test.login.dart | 3 +- test_driver/app.dart | 2 +- test_driver/app_test.dart | 4 +- test_driver/service/customer_service.dart | 1 - 96 files changed, 944 insertions(+), 655 deletions(-) diff --git a/i18n/en.json b/i18n/en.json index fb749f1..671ad00 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -551,6 +551,6 @@ "Exception: Please select your goal": "Please select your goal", "Exception: Please select your biologial gender": "Please select your biologial gender", "The found exercises are": "The found exercises are", - "in red": "in red", + "in green": "in green", "in your calendar": "in your calendar" } \ No newline at end of file diff --git a/i18n/hu.json b/i18n/hu.json index 04b89f6..4505fb0 100644 --- a/i18n/hu.json +++ b/i18n/hu.json @@ -551,6 +551,6 @@ "Exception: Please select your goal": "Kérlek válaszd ki a célod", "Exception: Please select your biologial gender": "Kérlek válaszd ki a biológiai nemed", "The found exercises are": "A keresett gyakorlatot", - "in red": "pirossal", + "in green": "zölddel", "in your calendar": "jelöltük a naptárban" } \ No newline at end of file diff --git a/ios/Podfile.lock b/ios/Podfile.lock index aa4c1bd..0fd6b15 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -8,23 +8,14 @@ PODS: - Flutter - devicelocale (0.0.1): - Flutter - - FBAEMKit (11.2.1): - - FBAEMKit/AEM (= 11.2.1) - - FBAEMKit/AEM (11.2.1): - - FBSDKCoreKit_Basics (~> 11.2.1) - - FBSDKCoreKit (11.2.1): - - FBSDKCoreKit/Core (= 11.2.1) - - FBSDKCoreKit/Core (11.2.1): - - FBAEMKit (~> 11.2.1) - - FBSDKCoreKit_Basics (~> 11.2.1) - - FBSDKCoreKit_Basics (11.2.1): - - FBSDKCoreKit_Basics/Basics (= 11.2.1) - - FBSDKCoreKit_Basics/Basics (11.2.1) - - FBSDKLoginKit (11.2.1): - - FBSDKLoginKit/Login (= 11.2.1) - - FBSDKLoginKit/Login (11.2.1): - - FBSDKCoreKit (~> 11.2.1) - - FBSDKCoreKit_Basics (~> 11.2.1) + - FBAEMKit (12.1.0): + - FBSDKCoreKit_Basics (= 12.1.0) + - FBSDKCoreKit (12.1.0): + - FBAEMKit (= 12.1.0) + - FBSDKCoreKit_Basics (= 12.1.0) + - FBSDKCoreKit_Basics (12.1.0) + - FBSDKLoginKit (12.1.0): + - FBSDKCoreKit (= 12.1.0) - Firebase/Analytics (8.9.0): - Firebase/Core - Firebase/Auth (8.9.0): @@ -47,30 +38,30 @@ PODS: - Firebase/RemoteConfig (8.9.0): - Firebase/CoreOnly - FirebaseRemoteConfig (~> 8.9.0) - - firebase_analytics (8.3.3): + - firebase_analytics (9.0.3): - Firebase/Analytics (= 8.9.0) - firebase_core - Flutter - - firebase_auth (3.1.2): + - firebase_auth (3.3.3): - Firebase/Auth (= 8.9.0) - firebase_core - Flutter - - firebase_core (1.10.0): + - firebase_core (1.10.5): - Firebase/CoreOnly (= 8.9.0) - Flutter - - firebase_dynamic_links (2.0.10): + - firebase_dynamic_links (4.0.2): - Firebase/DynamicLinks (= 8.9.0) - firebase_core - Flutter - - firebase_in_app_messaging (0.5.0-13): + - firebase_in_app_messaging (0.6.0-4): - Firebase/InAppMessaging (= 8.9.0) - firebase_core - Flutter - - firebase_messaging (10.0.8): + - firebase_messaging (11.2.3): - Firebase/Messaging (= 8.9.0) - firebase_core - Flutter - - firebase_remote_config (0.10.0-5): + - firebase_remote_config (1.0.2): - Firebase/RemoteConfig (= 8.9.0) - firebase_core - Flutter @@ -139,12 +130,14 @@ PODS: - Flutter (1.0.0) - flutter_app_badger (0.0.1): - Flutter - - flutter_facebook_auth (3.5.1): - - FBSDKCoreKit (~> 11.2.0) - - FBSDKLoginKit (~> 11.2.0) + - flutter_facebook_auth (3.5.3): + - FBSDKCoreKit (~> 12.1.0) + - FBSDKLoginKit (~> 12.1.0) - Flutter - flutter_secure_storage (3.3.1): - Flutter + - flutter_smartlook (0.0.5): + - Flutter - flutter_uxcam (2.0.1): - Flutter - UXCam (~> 3.3.6) @@ -219,14 +212,14 @@ PODS: - path_provider (0.0.1): - Flutter - PromisesObjC (2.0.0) - - Purchases (3.11.1): - - PurchasesCoreSwift (= 3.11.1) - - purchases_flutter (3.2.2): + - Purchases (3.13.1): + - PurchasesCoreSwift (= 3.13.1) + - purchases_flutter (3.8.0): - Flutter - - PurchasesHybridCommon (= 1.6.3) - - PurchasesCoreSwift (3.11.1) - - PurchasesHybridCommon (1.6.3): - - Purchases (= 3.11.1) + - PurchasesHybridCommon (= 1.11.1) + - PurchasesCoreSwift (3.13.1) + - PurchasesHybridCommon (1.11.1): + - Purchases (= 3.13.1) - Sentry (7.1.4): - Sentry/Core (= 7.1.4) - Sentry/Core (7.1.4) @@ -240,8 +233,6 @@ PODS: - Flutter - sign_in_with_apple (0.0.1): - Flutter - - smartlook (0.0.5): - - Flutter - sqflite (0.0.2): - Flutter - FMDB (>= 2.7.5) @@ -269,6 +260,7 @@ DEPENDENCIES: - flutter_app_badger (from `.symlinks/plugins/flutter_app_badger/ios`) - flutter_facebook_auth (from `.symlinks/plugins/flutter_facebook_auth/ios`) - flutter_secure_storage (from `.symlinks/plugins/flutter_secure_storage/ios`) + - flutter_smartlook (from `.symlinks/plugins/flutter_smartlook/ios`) - flutter_uxcam (from `.symlinks/plugins/flutter_uxcam/ios`) - google_sign_in (from `.symlinks/plugins/google_sign_in/ios`) - modal_progress_hud_nsn (from `.symlinks/plugins/modal_progress_hud_nsn/ios`) @@ -280,7 +272,6 @@ DEPENDENCIES: - share (from `.symlinks/plugins/share/ios`) - shared_preferences (from `.symlinks/plugins/shared_preferences/ios`) - sign_in_with_apple (from `.symlinks/plugins/sign_in_with_apple/ios`) - - smartlook (from `.symlinks/plugins/smartlook/ios`) - sqflite (from `.symlinks/plugins/sqflite/ios`) - url_launcher (from `.symlinks/plugins/url_launcher/ios`) - video_player (from `.symlinks/plugins/video_player/ios`) @@ -347,6 +338,8 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/flutter_facebook_auth/ios" flutter_secure_storage: :path: ".symlinks/plugins/flutter_secure_storage/ios" + flutter_smartlook: + :path: ".symlinks/plugins/flutter_smartlook/ios" flutter_uxcam: :path: ".symlinks/plugins/flutter_uxcam/ios" google_sign_in: @@ -369,8 +362,6 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/shared_preferences/ios" sign_in_with_apple: :path: ".symlinks/plugins/sign_in_with_apple/ios" - smartlook: - :path: ".symlinks/plugins/smartlook/ios" sqflite: :path: ".symlinks/plugins/sqflite/ios" url_launcher: @@ -386,18 +377,18 @@ SPEC CHECKSUMS: AppAuth: 31bcec809a638d7bd2f86ea8a52bd45f6e81e7c7 device_info: d7d233b645a32c40dfdc212de5cf646ca482f175 devicelocale: b22617f40038496deffba44747101255cee005b0 - FBAEMKit: 5de0a7aaa854eec69bb5be20795952a63d38a5f6 - FBSDKCoreKit: bf655f808b040ed66a72b9922911b39d703e64f4 - FBSDKCoreKit_Basics: 73ebe3a27eb688ac5b5aa7e99f68992993042115 - FBSDKLoginKit: 2e76831ef08d356b8f9150ea51cce865074ea304 + FBAEMKit: 56c0bb9b42e3747cd82b67934f0c2b19325382ea + FBSDKCoreKit: 75368765d9c2303073145a7925dfaa9d60bcd77b + FBSDKCoreKit_Basics: 39865aff97e5f6951a78fb3e89dc4460e35e1895 + FBSDKLoginKit: e993f97c7cc794c5da4056d8aec3c3d66033a727 Firebase: 13d8d96499e2635428d5bf0ec675df21f95d9a95 - firebase_analytics: b4b760056b69bcb2bf0ebbbb8cf6f969921a86fe - firebase_auth: 45e41687f7d88ce8016c1f411320911b842245d7 - firebase_core: f770e033e790657b3505f04be4cb24c482912f11 - firebase_dynamic_links: db82b85aee9c6066de135cdb4bee41e5b9e281ac - firebase_in_app_messaging: 180fcaea83c2c0555c5c0243bc9dc2c3b3358b2a - firebase_messaging: 51b1029537c74503e935e4ccb221da8be8cbf26e - firebase_remote_config: 2a43c3a6d3430fedb4f9f7360acc757d4d962bff + firebase_analytics: 022be8bd68c73ddaa23b77895e9098afa7069cfb + firebase_auth: fe3a1deb12ebd850295344234abc15588d086baf + firebase_core: dfcae4c150a5e24436a0b7677c470478a234d5bf + firebase_dynamic_links: 89300b4c80fa30b03487e56b2926d3261ae47af8 + firebase_in_app_messaging: 2a9226ba7eda70506a8ddf49ce1930d21fad3b5a + firebase_messaging: c4696ded2f44fb5c2bf6e94f9a575105793e58fa + firebase_remote_config: b6c8f06b74e803e9d03f9aa9adc58f0720feb3f7 FirebaseABTesting: 9de50b34bf9eb4a07d4edb7af82c14152fd905aa FirebaseAnalytics: 4ab446ce08a3fe52e8a4303dd997cf26276bf968 FirebaseAuth: 2b78b2a32c07b3ecfa4970bdf1d3632b8304099b @@ -410,11 +401,12 @@ SPEC CHECKSUMS: FirebaseRemoteConfig: a75c1bd44ebd3ed4ad3fa1ff09414a8b133be405 Flutter: 50d75fe2f02b26cc09d224853bb45737f8b3214a flutter_app_badger: 65de4d6f0c34a891df49e6cfb8a1c0496426fa68 - flutter_facebook_auth: 870a465b1afff3ace7a592bd44665d921991726c + flutter_facebook_auth: dfd6b2563406c538098e2127512d385c9ffd70ad flutter_secure_storage: 7953c38a04c3fdbb00571bcd87d8e3b5ceb9daec + flutter_smartlook: 2aa304f6a38fc22b741ca750e0078606582525ae flutter_uxcam: 32e4e8b4355be6bf9d512ad36aed6d86c98a5cdf FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a - google_sign_in: de494e5e993986afae63e22a32441e30c35c9823 + google_sign_in: c5cecea71f3be43282263550556e311c4cc03582 GoogleAppMeasurement: 837649ad3987936c232f6717c5680216f6243d24 GoogleDataTransport: 629c20a4d363167143f30ea78320d5a7eb8bd940 GoogleSignIn: 7137d297ddc022a7e0aa4619c86d72c909fa7213 @@ -427,21 +419,20 @@ SPEC CHECKSUMS: package_info_plus: 6c92f08e1f853dc01228d6f553146438dafcd14e path_provider: abfe2b5c733d04e238b0d8691db0cfd63a27a93c PromisesObjC: 68159ce6952d93e17b2dfe273b8c40907db5ba58 - Purchases: 6351f9ff6bd514e5ec5aa0f989ea181effa94bf5 - purchases_flutter: 627527b070d80cdaf486fabe8b3d1dbe8d5cad92 - PurchasesCoreSwift: ee857e4c21e6254b09d7e303a756fcf2b9164408 - PurchasesHybridCommon: d65a799a61d688588534b80338edbcbf604ca93d + Purchases: 2693d6444609de044ab25fcda9561bef038f24da + purchases_flutter: 214d452aaf860496aeee822487eafcdd962fab33 + PurchasesCoreSwift: ca55f9ef671f89abed133775dd9e53f55007828d + PurchasesHybridCommon: a0313de4f31fbaf137518b2686ccdca4c91dd2b4 Sentry: 1d3eb1a25f8c5333c88dd5603904a6d461cd9fcf sentry_flutter: f20d4f199442900fbdab2b8496f1d2091d8b94d9 share: 0b2c3e82132f5888bccca3351c504d0003b3b410 shared_preferences: af6bfa751691cdc24be3045c43ec037377ada40d sign_in_with_apple: f3bf75217ea4c2c8b91823f225d70230119b8440 - smartlook: bbc5c73a85c752a31dabf100c8930838c646342e sqflite: 6d358c025f5b867b29ed92fc697fd34924e11904 url_launcher: 6fef411d543ceb26efce54b05a0a40bfd74cbbef UXCam: fb294bf954e708fc308a645ae65bb967cac0760e video_player: 9cc823b1d9da7e8427ee591e8438bfbcde500e6e - wakelock: b0843b2479edbf6504d8d262c2959446f35373aa + wakelock: d0fc7c864128eac40eba1617cb5264d9c940b46f webview_flutter: 9f491a9b5a66f2573946a389b2677987b0ff8c0b PODFILE CHECKSUM: f10c0438b63bc24e6bbc207956dc27d16c4408f2 diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 51aff43..757a074 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -177,7 +177,7 @@ 97C146E61CF9000F007C117D /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 1210; + LastUpgradeCheck = 1300; ORGANIZATIONNAME = ""; TargetAttributes = { 97C146ED1CF9000F007C117D = { @@ -388,7 +388,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 2; + CURRENT_PROJECT_VERSION = 3; DEVELOPMENT_TEAM = SFJJBDCU6Z; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -531,7 +531,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 2; + CURRENT_PROJECT_VERSION = 3; DEVELOPMENT_TEAM = SFJJBDCU6Z; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -566,7 +566,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 2; + CURRENT_PROJECT_VERSION = 3; DEVELOPMENT_TEAM = SFJJBDCU6Z; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( diff --git a/lib/animations/test_progress_animation.dart b/lib/animations/test_progress_animation.dart index 1aa3cb5..c43e9fb 100644 --- a/lib/animations/test_progress_animation.dart +++ b/lib/animations/test_progress_animation.dart @@ -1,4 +1,3 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; class TestProgress extends AnimatedWidget { diff --git a/lib/bloc/development_by_muscle/development_by_muscle_bloc.dart b/lib/bloc/development_by_muscle/development_by_muscle_bloc.dart index 24bafd2..a9bc2ba 100644 --- a/lib/bloc/development_by_muscle/development_by_muscle_bloc.dart +++ b/lib/bloc/development_by_muscle/development_by_muscle_bloc.dart @@ -17,7 +17,6 @@ import 'package:intl/intl.dart'; import 'package:bloc/bloc.dart'; import 'package:equatable/equatable.dart'; import 'package:flutter/material.dart'; -import 'package:meta/meta.dart'; import 'package:fl_chart/fl_chart.dart'; part 'development_by_muscle_event.dart'; diff --git a/lib/bloc/exercise_new/exercise_new_bloc.dart b/lib/bloc/exercise_new/exercise_new_bloc.dart index 64f433c..1c1489b 100644 --- a/lib/bloc/exercise_new/exercise_new_bloc.dart +++ b/lib/bloc/exercise_new/exercise_new_bloc.dart @@ -14,9 +14,7 @@ import 'package:aitrainer_app/util/enums.dart'; import 'package:aitrainer_app/util/track.dart'; import 'package:bloc/bloc.dart'; import 'package:equatable/equatable.dart'; -import 'package:flutter/animation.dart'; import 'package:flutter/material.dart'; -import 'package:meta/meta.dart'; import 'package:stop_watch_timer/stop_watch_timer.dart'; part 'exercise_new_event.dart'; diff --git a/lib/bloc/menu/menu_bloc.dart b/lib/bloc/menu/menu_bloc.dart index 0743d6d..bff726f 100644 --- a/lib/bloc/menu/menu_bloc.dart +++ b/lib/bloc/menu/menu_bloc.dart @@ -18,7 +18,6 @@ import 'package:aitrainer_app/util/trans.dart'; import 'package:bloc/bloc.dart'; import 'package:equatable/equatable.dart'; import 'package:flutter/cupertino.dart'; -import 'package:meta/meta.dart'; import 'package:aitrainer_app/library/image_cache.dart' as wt; part 'menu_event.dart'; diff --git a/lib/bloc/sales/sales_bloc.dart b/lib/bloc/sales/sales_bloc.dart index 4a1c774..633880c 100644 --- a/lib/bloc/sales/sales_bloc.dart +++ b/lib/bloc/sales/sales_bloc.dart @@ -172,7 +172,7 @@ class SalesBloc extends Bloc with Logging { try { productSet = int.parse(productSetString); } on Exception catch (e) { - log("Define the right productset!"); + log("Define the right productset! $e"); productSet = 2; } diff --git a/lib/bloc/settings/settings_bloc.dart b/lib/bloc/settings/settings_bloc.dart index b687f52..c26eb07 100644 --- a/lib/bloc/settings/settings_bloc.dart +++ b/lib/bloc/settings/settings_bloc.dart @@ -9,8 +9,6 @@ import 'package:aitrainer_app/util/track.dart'; import 'package:bloc/bloc.dart'; import 'package:equatable/equatable.dart'; import 'package:flutter/cupertino.dart'; -//import 'package:health/health.dart'; -import 'package:meta/meta.dart'; part 'settings_event.dart'; part 'settings_state.dart'; @@ -20,71 +18,31 @@ class SettingsBloc extends Bloc with Logging { Locale? _locale; BuildContext? context; - SettingsBloc({this.context}) : super(SettingsInitial()); - - void setLocale(Locale locale) { - _locale = locale; + SettingsBloc({this.context}) : super(SettingsInitial()) { + on(_onChangeLanguage); + on(_onGetLanguage); + on(_onSetServer); } - Locale? getLocale() { - return _locale; + void setLocale(Locale locale) => _locale = locale; + Locale? getLocale() => _locale; + + void _onChangeLanguage(SettingsChangeLanguage event, Emitter emit) async { + emit(SettingsLoading()); + await _changeLang(event.language); + emit(SettingsReady()); } - @override - Stream mapEventToState( - SettingsEvent event, - ) async* { - if (event is SettingsChangeLanguage) { - yield SettingsLoading(); - await _changeLang(event.language); - yield SettingsReady(); - } else if (event is SettingsGetLanguage) { - await AppLanguage().fetchLocale(); - _locale = AppLanguage().appLocal; - yield SettingsReady(); - } else if (event is SettingsSetServer) { - //yield SettingsLoading(); - final bool live = event.live; - Cache().setServer(live); - Track().track(TrackingEvent.settings_server, eventValue: live.toString()); - //yield SettingsReady(_locale); - } else if (event is SettingsSetHardware) { - yield SettingsLoading(); - - bool selectedHardwareBefore = await Cache().selectedHardwareBefore(); - log("selectedBefore " + selectedHardwareBefore.toString()); - - final bool hasHardware = event.hasHardware; - await Cache().setHardware(hasHardware); - if (hasHardware == true) { - await _accessHealthData(); - } - Cache().initBadges(); - yield SettingsReady(); - } else if (event is SettingsActivateTutorial) { - yield SettingsLoading(); - Cache().activitiesDone[event.activity.toStr()] = false; - print(" ----------------- Setting ${event.activity} to false"); - yield SettingsReady(); - } + void _onGetLanguage(SettingsGetLanguage event, Emitter emit) async { + await AppLanguage().fetchLocale(); + _locale = AppLanguage().appLocal; + emit(SettingsReady()); } - Future _accessHealthData() async { - /* final List types = [ - HealthDataType.ACTIVE_ENERGY_BURNED, - HealthDataType.WATER, - HealthDataType.STEPS, - HealthDataType.HEART_RATE, - HealthDataType.BASAL_ENERGY_BURNED, - HealthDataType.BODY_TEMPERATURE, - HealthDataType.HIGH_HEART_RATE_EVENT, - HealthDataType.LOW_HEART_RATE_EVENT, - HealthDataType.RESTING_HEART_RATE - ]; - final HealthFactory health = HealthFactory(); */ - //DateTime now = DateTime.now(); - //List _healthDataList = await health.getHealthDataFromTypes(now.subtract(Duration(minutes: 5)), now, types); - //log(_healthDataList.toString()); + void _onSetServer(SettingsSetServer event, Emitter emit) async { + final bool live = event.live; + Cache().setServer(live); + Track().track(TrackingEvent.settings_server, eventValue: live.toString()); } Future _changeLang(String lang) async { diff --git a/lib/bloc/training_evaluation/training_evaluation_bloc.dart b/lib/bloc/training_evaluation/training_evaluation_bloc.dart index d5fe225..14166f5 100644 --- a/lib/bloc/training_evaluation/training_evaluation_bloc.dart +++ b/lib/bloc/training_evaluation/training_evaluation_bloc.dart @@ -1,4 +1,3 @@ -import 'dart:async'; import 'package:intl/intl.dart'; import 'package:aitrainer_app/bloc/training_plan/training_plan_bloc.dart'; import 'package:aitrainer_app/model/cache.dart'; @@ -16,7 +15,9 @@ part 'training_evaluation_state.dart'; class TrainingEvaluationBloc extends Bloc { final TrainingPlanBloc trainingPlanBloc; final String day; - TrainingEvaluationBloc({required this.trainingPlanBloc, required this.day}) : super(TrainingEvaluationInitial()); + TrainingEvaluationBloc({required this.trainingPlanBloc, required this.day}) : super(TrainingEvaluationInitial()) { + on(_onLoad); + } String duration = "-"; String totalLift = "0"; @@ -27,6 +28,21 @@ class TrainingEvaluationBloc extends Bloc evaluationList = []; + void _onLoad(TrainingEvaluationLoad event, Emitter emit) async { + getDuration(); + getTotalLift(); + getMaxRepeats(); + getTotalRepeats(); + createEvaluationData(); + getMaxLift(); + if (end == null || DateTime.now().difference(end!).inMinutes > 5) { + emit(TrainingEvaluationReady()); + } else { + emit(TrainingEvaluationVictoryReady()); + } + } + +/* @override Stream mapEventToState( TrainingEvaluationEvent event, @@ -50,9 +66,7 @@ class TrainingEvaluationBloc extends Bloc saveResult() async {} + } */ void createEvaluationData() { if (trainingPlanBloc.getMyPlan() == null || trainingPlanBloc.getMyPlan()!.days[day] == null) { @@ -118,11 +132,11 @@ class TrainingEvaluationBloc extends Bloc 1.10) { + if (rate > 1.20) { return "Strongly Growing"; } else if (rate > 1.05) { return "Growing"; - } else if (rate < 0.90) { + } else if (rate < 0.80) { return "Strongly Sinking"; } else if (rate < 0.95) { return "Sinking"; @@ -132,11 +146,11 @@ class TrainingEvaluationBloc extends Bloc 1.10) { + if (rate > 1.20) { return Colors.green[900]!; } else if (rate > 1.05) { return Colors.green[300]!; - } else if (rate < 0.90) { + } else if (rate < 0.80) { return Colors.red[900]!; } else if (rate < 0.95) { return Colors.red[400]!; diff --git a/lib/bloc/training_log/training_log_bloc.dart b/lib/bloc/training_log/training_log_bloc.dart index 23e6c45..5c650ff 100644 --- a/lib/bloc/training_log/training_log_bloc.dart +++ b/lib/bloc/training_log/training_log_bloc.dart @@ -18,6 +18,7 @@ part 'training_log_state.dart'; class TrainingLogBloc extends Bloc { final ExerciseRepository exerciseRepository = ExerciseRepository(); + TrainingLogBloc() : super(TrainingLogInitial()) { on(_onLoad); on(_onDelete); @@ -49,6 +50,11 @@ class TrainingLogBloc extends Bloc { emit(TrainingLogLoading()); exerciseRepository.exerciseList!.remove(event.exercise); await exerciseRepository.deleteExercise(event.exercise); + if (Cache().getExercises() != null) { + Cache().getExercises()!.remove(event.exercise); + } + _results.clear(); + _results.addAll(getTrainingResults()); Track().track(TrackingEvent.exercise_log_delete); emit(TrainingLogReady()); } @@ -119,7 +125,7 @@ class TrainingLogBloc extends Bloc { Color color = exercise.trainingPlanDetailsId == null ? Colors.blue : Colors.orange; if (exerciseTypeIdSearched == exercise.exerciseTypeId) { - color = Colors.redAccent; + color = Color(0xffb4f500); } trainings.add(TrainingResult( diff --git a/lib/bloc/training_plan/training_plan_bloc.dart b/lib/bloc/training_plan/training_plan_bloc.dart index e866b10..b0d3dd9 100644 --- a/lib/bloc/training_plan/training_plan_bloc.dart +++ b/lib/bloc/training_plan/training_plan_bloc.dart @@ -1,4 +1,3 @@ -import 'dart:async'; import 'package:aitrainer_app/main.dart'; import 'package:aitrainer_app/bloc/menu/menu_bloc.dart'; import 'package:aitrainer_app/model/cache.dart'; @@ -29,7 +28,25 @@ part 'training_plan_state.dart'; class TrainingPlanBloc extends Bloc { final TrainingPlanRepository trainingPlanRepository; final MenuBloc menuBloc; - TrainingPlanBloc({required this.trainingPlanRepository, required this.menuBloc}) : super(TrainingPlanInitial()); + TrainingPlanBloc({required this.trainingPlanRepository, required this.menuBloc}) : super(TrainingPlanInitial()) { + on(_onActivate); + on(_onWeightChangeRecalculate); + on(_onSaveExercise); + on(_onSkipExercise); + on(_onSkipEntireExercise); + on(_onFinishDropSet); + on(_onFinishDay); + on(_onChangeCancel); + + on(_onCustomLoad); + on(_onDeleteExerciseType); + on(_onCustomWeightChange); + on(_onCustomPlanSetChange); + on(_onCustomPlanRepeatChange); + on(_onCustomPlanAddExerciseType); + + // on(_onTrainingPlanError); + } CustomerTrainingPlan? _myPlan; CustomerTrainingPlanDetails? _myDetail; @@ -55,264 +72,351 @@ class TrainingPlanBloc extends Bloc { CustomerTrainingPlanDetails? getMyDetail() => this._myDetail; setMyDetail(CustomerTrainingPlanDetails? value) => this._myDetail = value; + /// _onActivate + /// activating the training plan, calculating the weights to the given repeats + /// from previous exercises + /// + /// event: TrainingPlanActivate + void _onActivate(TrainingPlanActivate event, Emitter emit) async { + emit(TrainingPlanLoading()); + _myPlan = trainingPlanRepository.activateTrainingPlan(event.trainingPlanId); + _myPlan!.type = CustomerTrainingPlanType.template; + + menuBloc.menuTreeRepository.sortedTree.forEach((name, list) { + final List menuList = list as List; + menuList.forEach((element) { + element.exerciseType!.trainingPlanState = ExerciseTypeTrainingPlanState.none; + }); + }); + this.activateDays(); + Cache().myTrainingPlan = _myPlan; + await Cache().saveMyTrainingPlan(); + Track().track(TrackingEvent.training_plan_start, eventValue: event.trainingPlanId.toString()); + emit(TrainingPlanFinished()); + } + + void _onWeightChangeRecalculate(TrainingPlanWeightChangeRecalculate event, Emitter emit) async { + emit(TrainingPlanExerciseLoading()); + + if (event.detail.baseOneRepMax > 0 && event.detail.repeats != -1) { + if (_myTrainingPlan == null) { + setTrainingPlanFromCache(); + } + final int originalRepeats = trainingPlanRepository.getOriginalRepeats(_myTrainingPlan!.trainingPlanId, event.detail); + event.detail.repeats = Common.calculateQuantityByChangedWeight(event.detail.baseOneRepMax, event.weight, originalRepeats.toDouble()); + + print("Base1RM ${event.detail.baseOneRepMax} repeats: ${event.detail.repeats}"); + if (event.detail.repeats! < 1) { + event.detail.repeats = 1; + event.detail.weight = trainingPlanRepository.getOriginalWeight(_myTrainingPlan!.trainingPlanId, event.detail); + } + ExerciseSaveStream().repeats = event.detail.repeats!; + ExerciseSaveStream().getStreamController().add(true); + } + event.detail.weight = event.weight; + + ///yield TrainingPlanExerciseReady(); + emit(TrainingPlanReady()); + } + + /// _onSaveExercise + /// - save the executed exercise to the DB + /// - recalculate, if necessary the next weight to the give repeats + /// - track this event + /// - send the data to Mautic + /// if [DropSet], the just set the state of the detail to finish + /// + /// event: TrainingPlanWeightChange + void _onSaveExercise(TrainingPlanSaveExercise event, Emitter emit) async { + emit(TrainingPlanLoading()); + if (event.detail.repeats == -1) { + emit(TrainingPlanReady()); + throw Exception("Please type your repeats!"); + } + print("SAVE for ExerciseTypeID: ${event.detail.exerciseTypeId} weight: ${event.detail.weight}"); + if (event.detail.weight == -3) { + print("DropSet"); + event.detail.state = ExercisePlanDetailState.finished; + emit(TrainingPlanReady()); + } else { + final Exercise exercise = Exercise(); + exercise.customerId = Cache().userLoggedIn!.customerId!; + exercise.exerciseTypeId = event.detail.exerciseTypeId; + exercise.quantity = event.detail.repeats!.toDouble(); + exercise.unit = event.detail.exerciseType!.unit; + exercise.unitQuantity = event.detail.weight; + exercise.dateAdd = DateTime.now(); + event.detail.exercises.add(exercise); + if (this.isAllDetailsSameExerciseFinished(event.detail)) { + event.detail.state = ExercisePlanDetailState.finished; + } + + // recalculate the weight to the original planned repeats for the next details + int id = 0; + if (exercise.unitQuantity != null && exercise.unitQuantity! > 0) { + for (var nextDetail in _myPlan!.details) { + if (nextDetail.exerciseTypeId == event.detail.exerciseTypeId) { + if (id == 0 && nextDetail.customerTrainingPlanDetailsId == event.detail.customerTrainingPlanDetailsId) { + id = nextDetail.customerTrainingPlanDetailsId!; + } + double weightFromPlan = trainingPlanRepository.getOriginalWeight(this.getMyPlan()!.trainingPlanId!, nextDetail); + print("NextDetail detail: $nextDetail *** PlanWeight: $weightFromPlan"); + if (nextDetail.weight == -2 && nextDetail.customerTrainingPlanDetailsId != event.detail.customerTrainingPlanDetailsId) { + print("Nr 1. - recalculating -2 ${event.detail.customerTrainingPlanDetailsId}"); + trainingPlanRepository.recalculateDetail(_myPlan!.trainingPlanId!, event.detail, nextDetail); + nextDetail.baseOneRepMax = Common.calculate1RM(nextDetail.weight!, nextDetail.repeats!.toDouble()); + } else if (weightFromPlan == -1 && nextDetail.set! > 1 && nextDetail.exercises.length == 1) { + print("Nr 2. recalculating -1 ${event.detail.customerTrainingPlanDetailsId}"); + nextDetail = trainingPlanRepository.recalculateDetailFixRepeats(_myPlan!.trainingPlanId!, nextDetail); + nextDetail.baseOneRepMax = Common.calculate1RM(nextDetail.weight!, nextDetail.repeats!.toDouble()); + } else if (nextDetail.weight == -1 && nextDetail.set! == 1) { + print("Nr 3. recalculating -1, set 1 ${event.detail.customerTrainingPlanDetailsId}"); + nextDetail = trainingPlanRepository.recalculateDetailFixRepeatsSet1(_myPlan!.trainingPlanId!, nextDetail, event.detail); + nextDetail.baseOneRepMax = Common.calculate1RM(nextDetail.weight!, nextDetail.repeats!.toDouble()); + } else if (event.detail.set! == 1 && + (weightFromPlan == -2 || weightFromPlan == -1) && + nextDetail.customerTrainingPlanDetailsId! > id) { + print("Nr 4. recalculating after the first exercise ${event.detail.customerTrainingPlanDetailsId}"); + nextDetail = trainingPlanRepository.recalculateDetailFixRepeatsSet1(_myPlan!.trainingPlanId!, nextDetail, event.detail); + nextDetail.baseOneRepMax = Common.calculate1RM(nextDetail.weight!, nextDetail.repeats!.toDouble()); + } + } + } + } + + exercise.trainingPlanDetailsId = _myPlan!.trainingPlanId; + + // save Exercise + Exercise savedExercise = await ExerciseApi().addExercise(exercise); + Cache().addExercise(savedExercise); + + Cache().myTrainingPlan = _myPlan; + await Cache().saveMyTrainingPlan(); + } + if (!isInDebugMode) { + CustomerRepository customerRepository = CustomerRepository(); + customerRepository.customer = Cache().userLoggedIn; + MauticRepository mauticRepository = MauticRepository(customerRepository: customerRepository); + await mauticRepository.sendMauticExercise(); + } + Track().track(TrackingEvent.training_plan_execute, eventValue: event.detail.exerciseType!.name); + + if (isDayDone()) { + this.add(TrainingPlanFinishDay()); + } else { + emit(TrainingPlanReady()); + } + } + + void _onSkipExercise(TrainingPlanSkipExercise event, Emitter emit) async { + emit(TrainingPlanLoading()); + event.detail.state = ExercisePlanDetailState.skipped; + Cache().myTrainingPlan = _myPlan; + await Cache().saveMyTrainingPlan(); + if (isDayDone()) { + this.add(TrainingPlanFinishDay()); + } else { + emit(TrainingPlanReady()); + } + } + + void _onSkipEntireExercise(TrainingPlanSkipEntireExercise event, Emitter emit) async { + emit(TrainingPlanLoading()); + List list = getAllDetailsSameExercise(event.detail); + list.forEach((element) { + if (!element.state.equalsTo(ExercisePlanDetailState.finished)) { + element.state = ExercisePlanDetailState.skipped; + } + Cache().myTrainingPlan = _myPlan; + }); + await Cache().saveMyTrainingPlan(); + if (isDayDone()) { + this.add(TrainingPlanFinishDay()); + } else { + emit(TrainingPlanReady()); + } + } + + void _onFinishDropSet(TrainingPlanFinishDropset event, Emitter emit) async { + emit(TrainingPlanLoading()); + event.detail.state = ExercisePlanDetailState.finished; + emit(TrainingPlanReady()); + } + + void _onFinishDay(TrainingPlanFinishDay event, Emitter emit) async { + emit(TrainingPlanLoading()); + celebrating = true; + Track().track(TrackingEvent.training_plan_finished); + emit(TrainingPlanDayFinished()); + } + + void _onChangeCancel(TrainingPlanChangeCancel event, Emitter emit) async { + emit(TrainingPlanLoading()); + print("Backup $_backupDetail"); + if (_backupDetail != null) { + event.detail.repeats = _backupDetail!.repeats; + event.detail.weight = _backupDetail!.weight; + } + emit(TrainingPlanReady()); + } + + void _onCustomLoad(TrainingPlanAddLoad event, Emitter emit) async { + emit(TrainingPlanLoading()); + addNewPlan(); + + _myDetail = CustomerTrainingPlanDetails(); + _myDetail!.exerciseType = event.exerciseType; + _myDetail!.exerciseTypeId = event.exerciseType.exerciseTypeId; + _myDetail!.repeats = 12; + _myDetail!.weight = 30; + _myDetail!.set = 3; + _myDetail!.parallel = false; + _myDetail!.day = ""; + _myDetail!.restingTime = 2; + _myDetail!.state = ExercisePlanDetailState.start; + + if (_myDetail!.exerciseType!.unitQuantityUnit != null) { + _myDetail = trainingPlanRepository.getCalculatedWeightRepeats(event.exerciseType.exerciseTypeId, _myDetail!); + } else { + _myDetail!.weight = 0; + } + Track().track(TrackingEvent.training_plan_custom, eventValue: event.exerciseType.name); + emit(TrainingPlanReady()); + } + + void _onDeleteExerciseType(TrainingPlanDeleteExerciseType event, Emitter emit) async { + if (_myPlan == null || _myPlan!.details.isEmpty) { + throw Exception("No MyPlan"); + } + emit(TrainingPlanLoading()); + CustomerTrainingPlanDetails? remove; + for (var detail in _myPlan!.details) { + if (event.exerciseType.exerciseTypeId == detail.exerciseTypeId) { + remove = detail; + break; + } + } + if (remove != null) { + _myPlan!.details.remove(remove); + } + event.exerciseType.trainingPlanState = ExerciseTypeTrainingPlanState.none; + emit(TrainingPlanReady()); + } + + /// _onWeightChange + /// change the weight of the actual [CustomerTrainingPlanDetails] from the UI + /// + /// event: TrainingPlanWeightChange + void _onCustomWeightChange(TrainingPlanWeightChange event, Emitter emit) async { + emit(TrainingPlanExerciseLoading()); + event.detail.weight = event.weight; + + emit(TrainingPlanExerciseReady()); + emit(TrainingPlanReady()); + } + + void _onCustomPlanSetChange(TrainingPlanSetChange event, Emitter emit) async { + emit(TrainingPlanLoading()); + event.detail.set = event.set; + emit(TrainingPlanReady()); + } + + void _onCustomPlanRepeatChange(TrainingPlanRepeatsChange event, Emitter emit) async { + emit(TrainingPlanLoading()); + event.detail.repeats = event.repeats; + emit(TrainingPlanReady()); + } + + void _onCustomPlanAddExerciseType(TrainingPlanAddExerciseType event, Emitter emit) async { + if (_myDetail == null) { + throw Exception("Create new Detail"); + } + emit(TrainingPlanLoading()); + _myDetail!.exerciseType!.trainingPlanState = ExerciseTypeTrainingPlanState.added; + _myPlan!.details.add(this._myDetail!); + emit(TrainingPlanReady()); + } +/* @override Stream mapEventToState(TrainingPlanEvent event) async* { try { if (event is TrainingPlanActivate) { - yield TrainingPlanLoading(); - _myPlan = trainingPlanRepository.activateTrainingPlan(event.trainingPlanId); - _myPlan!.type = CustomerTrainingPlanType.template; - - menuBloc.menuTreeRepository.sortedTree.forEach((name, list) { - final List menuList = list as List; - menuList.forEach((element) { - element.exerciseType!.trainingPlanState = ExerciseTypeTrainingPlanState.none; - }); - }); - this.activateDays(); - Cache().myTrainingPlan = _myPlan; - await Cache().saveMyTrainingPlan(); - Track().track(TrackingEvent.training_plan_start, eventValue: event.trainingPlanId.toString()); - yield TrainingPlanFinished(); + } else if (event is TrainingPlanWeightChange) { - yield TrainingPlanExerciseLoading(); - print("New weight: ${event.weight}"); - event.detail.weight = event.weight; - - yield TrainingPlanExerciseReady(); - yield TrainingPlanReady(); - } else if (event is TrainingPlanWeightChangeUp) { - yield TrainingPlanExerciseLoading(); - if (event.detail.weight != null) { - event.detail.repeats = - Common.reCalculateRepeatsByChangedWeight(event.detail.weight!, event.detail.repeats!.toDouble(), event.detail.weight! + 1); - event.detail.weight = event.detail.weight! + 1; - ExerciseSaveStream().weight = event.detail.weight!; - ExerciseSaveStream().repeats = event.detail.repeats!; - ExerciseSaveStream().getStreamController().add(true); - } - - yield TrainingPlanExerciseReady(); - yield TrainingPlanReady(); - } else if (event is TrainingPlanWeightChangeDown) { - yield TrainingPlanExerciseLoading(); - if (event.detail.weight != null) { - event.detail.repeats = - Common.reCalculateRepeatsByChangedWeight(event.detail.weight!, event.detail.repeats!.toDouble(), event.detail.weight! - 1); - event.detail.weight = event.detail.weight! - 1; - ExerciseSaveStream().weight = event.detail.weight!; - ExerciseSaveStream().repeats = event.detail.repeats!; - ExerciseSaveStream().getStreamController().add(true); - } - - yield TrainingPlanExerciseReady(); - yield TrainingPlanReady(); - } else if (event is TrainingPlanWeightChangeRecalculate) { - yield TrainingPlanExerciseLoading(); - - if (event.detail.baseOneRepMax > 0 && event.detail.repeats != -1) { - if (_myTrainingPlan == null) { - setTrainingPlanFromCache(); - } - final int originalRepeats = trainingPlanRepository.getOriginalRepeats(_myTrainingPlan!.trainingPlanId, event.detail); - event.detail.repeats = - Common.calculateQuantityByChangedWeight(event.detail.baseOneRepMax, event.weight, originalRepeats.toDouble()); - - print("Base1RM ${event.detail.baseOneRepMax} repeats: ${event.detail.repeats}"); - if (event.detail.repeats! < 1) { - event.detail.repeats = 1; - event.detail.weight = trainingPlanRepository.getOriginalWeight(_myTrainingPlan!.trainingPlanId, event.detail); - } - ExerciseSaveStream().repeats = event.detail.repeats!; - ExerciseSaveStream().getStreamController().add(true); - } - event.detail.weight = event.weight; - yield TrainingPlanExerciseReady(); - yield TrainingPlanReady(); + + } else if (event is TrainingPlanWeightChangeRecalculate) { + } else if (event is TrainingPlanRepeatsChange) { - yield TrainingPlanExerciseLoading(); - - event.detail.repeats = event.repeats; - yield TrainingPlanExerciseReady(); - yield TrainingPlanReady(); + } else if (event is TrainingPlanSetChange) { - yield TrainingPlanLoading(); - - event.detail.set = event.set; - - yield TrainingPlanReady(); + } else if (event is TrainingPlanSaveExercise) { - yield TrainingPlanLoading(); - if (event.detail.repeats == -1) { - yield TrainingPlanReady(); - throw Exception("Please type your repeats!"); - } - print("SAVE for ExerciseTypeID: ${event.detail.exerciseTypeId} weight: ${event.detail.weight}"); - if (event.detail.weight == -3) { - print("DropSet"); - event.detail.state = ExercisePlanDetailState.finished; - yield TrainingPlanReady(); - } else { - final Exercise exercise = Exercise(); - exercise.customerId = Cache().userLoggedIn!.customerId!; - exercise.exerciseTypeId = event.detail.exerciseTypeId; - exercise.quantity = event.detail.repeats!.toDouble(); - exercise.unit = event.detail.exerciseType!.unit; - exercise.unitQuantity = event.detail.weight; - exercise.dateAdd = DateTime.now(); - event.detail.exercises.add(exercise); - if (this.isAllDetailsSameExerciseFinished(event.detail)) { - event.detail.state = ExercisePlanDetailState.finished; - } - // recalculate the weight to the original planned repeats for the next details - if (exercise.unitQuantity != null && exercise.unitQuantity! > 0) { - for (var nextDetail in _myPlan!.details) { - double weightFromPlan = trainingPlanRepository.getOriginalWeight(this.getMyPlan()!.trainingPlanId!, nextDetail); - print("NextDetail detail: $nextDetail *** PlanWeight: $weightFromPlan"); - if (nextDetail.exerciseTypeId == event.detail.exerciseTypeId && - nextDetail.weight == -2 && - nextDetail.customerTrainingPlanDetailsId != event.detail.customerTrainingPlanDetailsId) { - print("recalculating -2 ${event.detail.customerTrainingPlanDetailsId}"); - trainingPlanRepository.recalculateDetail(_myPlan!.trainingPlanId!, event.detail, nextDetail); - nextDetail.baseOneRepMax = Common.calculate1RM(nextDetail.weight!, nextDetail.repeats!.toDouble()); - } else if (nextDetail.exerciseTypeId == event.detail.exerciseTypeId && weightFromPlan == -1 && nextDetail.set! > 1) { - print("recalculating -1 ${event.detail.customerTrainingPlanDetailsId}"); - nextDetail = trainingPlanRepository.recalculateDetailFixRepeats(_myPlan!.trainingPlanId!, nextDetail); - nextDetail.baseOneRepMax = Common.calculate1RM(nextDetail.weight!, nextDetail.repeats!.toDouble()); - } else if (nextDetail.exerciseTypeId == event.detail.exerciseTypeId && nextDetail.weight == -1 && nextDetail.set! == 1) { - print("recalculating -1, set 1 ${event.detail.customerTrainingPlanDetailsId}"); - nextDetail = trainingPlanRepository.recalculateDetailFixRepeatsSet1(_myPlan!.trainingPlanId!, nextDetail, event.detail); - nextDetail.baseOneRepMax = Common.calculate1RM(nextDetail.weight!, nextDetail.repeats!.toDouble()); - } /* else if (nextDetail.exerciseTypeId == event.detail.exerciseTypeId && - weightFromPlan == -2 && - nextDetail.set! == 1 && - nextDetail.exercises.length == 0) { - print("recalculating -1/ no exercise, set 1 ${event.detail.customerTrainingPlanDetailsId}"); - nextDetail = trainingPlanRepository.recalculateDetailFixRepeatsSet1(_myPlan!.trainingPlanId!, nextDetail, event.detail); - nextDetail.baseOneRepMax = Common.calculate1RM(nextDetail.weight!, nextDetail.repeats!.toDouble()); - }*/ - } - } - - exercise.trainingPlanDetailsId = _myPlan!.trainingPlanId; - - // save Exercise - Exercise savedExercise = await ExerciseApi().addExercise(exercise); - Cache().addExercise(savedExercise); - - Cache().myTrainingPlan = _myPlan; - await Cache().saveMyTrainingPlan(); - } - if (!isInDebugMode) { - CustomerRepository customerRepository = CustomerRepository(); - customerRepository.customer = Cache().userLoggedIn; - MauticRepository mauticRepository = MauticRepository(customerRepository: customerRepository); - await mauticRepository.sendMauticExercise(); - } - Track().track(TrackingEvent.training_plan_execute, eventValue: event.detail.exerciseType!.name); - - if (isDayDone()) { - this.add(TrainingPlanFinishDay()); - } else { - yield TrainingPlanReady(); - } + } else if (event is TrainingPlanSkipExercise) { - yield TrainingPlanLoading(); - event.detail.state = ExercisePlanDetailState.skipped; - Cache().myTrainingPlan = _myPlan; - await Cache().saveMyTrainingPlan(); - if (isDayDone()) { - this.add(TrainingPlanFinishDay()); - } else { - yield TrainingPlanReady(); - } + } else if (event is TrainingPlanSkipEntireExercise) { - yield TrainingPlanLoading(); - List list = getAllDetailsSameExercise(event.detail); - list.forEach((element) { - if (!element.state.equalsTo(ExercisePlanDetailState.finished)) { - element.state = ExercisePlanDetailState.skipped; - } - Cache().myTrainingPlan = _myPlan; - }); - await Cache().saveMyTrainingPlan(); - if (isDayDone()) { - this.add(TrainingPlanFinishDay()); - } else { - yield TrainingPlanReady(); - } + } else if (event is TrainingPlanFinishDay) { - yield TrainingPlanLoading(); - celebrating = true; - Track().track(TrackingEvent.training_plan_finished); - yield TrainingPlanDayFinished(); + } else if (event is TrainingPlanGoToRestart) { yield TrainingPlanLoading(); restarting = true; yield TrainingPlanDayReadyToRestart(); } else if (event is TrainingPlanAddExerciseType) { - if (_myDetail == null) { - throw Exception("Create new Detail"); - } - yield TrainingPlanLoading(); - _myDetail!.exerciseType!.trainingPlanState = ExerciseTypeTrainingPlanState.added; - _myPlan!.details.add(this._myDetail!); - yield TrainingPlanReady(); + } else if (event is TrainingPlanDeleteExerciseType) { - if (_myPlan == null || _myPlan!.details.isEmpty) { - throw Exception("No MyPlan"); - } - yield TrainingPlanLoading(); - CustomerTrainingPlanDetails? remove; - for (var detail in _myPlan!.details) { - if (event.exerciseType.exerciseTypeId == detail.exerciseTypeId) { - remove = detail; - break; - } - } - if (remove != null) { - _myPlan!.details.remove(remove); - } - event.exerciseType.trainingPlanState = ExerciseTypeTrainingPlanState.none; - yield TrainingPlanReady(); + } else if (event is TrainingPlanCustomAddLoad) { - yield TrainingPlanLoading(); - addNewPlan(); - - _myDetail = CustomerTrainingPlanDetails(); - _myDetail!.exerciseType = event.exerciseType; - _myDetail!.exerciseTypeId = event.exerciseType.exerciseTypeId; - _myDetail!.repeats = 12; - _myDetail!.weight = 30; - _myDetail!.set = 3; - _myDetail!.parallel = false; - _myDetail!.day = ""; - _myDetail!.restingTime = 2; - _myDetail!.state = ExercisePlanDetailState.start; - - if (_myDetail!.exerciseType!.unitQuantityUnit != null) { - _myDetail = trainingPlanRepository.getCalculatedWeightRepeats(event.exerciseType.exerciseTypeId, _myDetail!); - } else { - _myDetail!.weight = 0; - } - Track().track(TrackingEvent.training_plan_custom, eventValue: event.exerciseType.name); - yield TrainingPlanReady(); + } else if (event is TrainingPlanChangeCancel) { - yield TrainingPlanLoading(); - print("Backup $_backupDetail"); - if (_backupDetail != null) { - event.detail.repeats = _backupDetail!.repeats; - event.detail.weight = _backupDetail!.weight; - } - yield TrainingPlanReady(); + } else if (event is TrainingPlanFinishDropset) { - yield TrainingPlanLoading(); - event.detail.state = ExercisePlanDetailState.finished; - yield TrainingPlanReady(); + } } on Exception catch (e) { yield TrainingPlanError(message: e.toString()); } + } */ + + CustomerTrainingPlanDetails? createDetailFromExerciseType(ExerciseType exerciseType, CustomerTrainingPlanDetails origDetail) { + List list = []; + int index = 0; + TrainingPlanDetail? trainingPlanDetail; + if (_myTrainingPlan == null) { + setTrainingPlanFromCache(); + } + for (var planDetail in _myTrainingPlan!.details!) { + if (planDetail.exerciseTypeId == origDetail.exerciseTypeId!) { + trainingPlanDetail = planDetail; + break; + } + index++; + } + if (trainingPlanDetail != null) { + list = + trainingPlanRepository.createDetail(_myPlan!, trainingPlanDetail, exerciseType.exerciseTypeId, index, changeExerciseType: true); + + List deleteIndicies = []; + index = 0; + _myPlan!.details.forEach((element) { + if (element.exerciseTypeId == origDetail.exerciseTypeId) { + deleteIndicies.add(index); + } + index++; + }); + + index = 0; + deleteIndicies.forEach((i) { + _myPlan!.details.removeAt(i - index); + index++; + }); + _myPlan!.details.insertAll(deleteIndicies[0], list); + } + if (list.length > 0) { + return list[0]; + } else { + return null; + } } void backupDetail(CustomerTrainingPlanDetails detail) { @@ -380,7 +484,8 @@ class TrainingPlanBloc extends Bloc { } if (isDone100Percent()) { - this.add(TrainingPlanGoToRestart()); + //this.add(TrainingPlanGoToRestart()); + print("---------------- TrainingPlanGoToRestart"); } dayNames.clear(); _myPlan!.days.clear(); @@ -556,20 +661,29 @@ class TrainingPlanBloc extends Bloc { int getStep(CustomerTrainingPlanDetails detail) { List details = getAllDetailsSameExercise(detail); int step = 0; - int indexElement = 0; details.forEach((element) { - if (indexElement == 0) { + if (element.exercises.length < element.set! && element.exercises.length > 0) { step = element.exercises.length; - } else { - step += element.exercises.length; } - indexElement++; }); - + step++; //print("STEP: $step "); return step; } + int getHighlightStep(CustomerTrainingPlanDetails detail) { + List details = getAllDetailsSameExercise(detail); + int step = 0; + details.forEach((element) { + //print("Highlight element $element"); + if (element.exercises.length >= element.set!) { + step++; + } + }); + //print("Highlight step: $step "); + return step; + } + CustomerTrainingPlanDetails? getNext() { if (_myPlan == null || _myPlan!.details.isEmpty) { return null; @@ -655,8 +769,8 @@ class TrainingPlanBloc extends Bloc { } prev = detail; } - int index = indexInStart > indexInProgress ? indexInStart : indexInProgress; - offset = (index) * 300; + double index = indexInStart > indexInProgress ? indexInStart.toDouble() : indexInProgress.toDouble(); + offset = 325 * index; print("Offset: $offset day: $day ($indexInStart, $indexInProgress)"); return offset; } @@ -706,7 +820,8 @@ class TrainingPlanBloc extends Bloc { if (activeDayIndex >= dayNames.length) { activeDayIndex = 0; - this.add(TrainingPlanGoToRestart()); + //this.add(TrainingPlanGoToRestart()); + print("---------------- TrainingPlanGoToRestart"); } print("ActiveDayIndex $activeDayIndex"); return activeDayIndex; diff --git a/lib/bloc/training_plan/training_plan_event.dart b/lib/bloc/training_plan/training_plan_event.dart index 6971190..69ac1bd 100644 --- a/lib/bloc/training_plan/training_plan_event.dart +++ b/lib/bloc/training_plan/training_plan_event.dart @@ -119,20 +119,13 @@ class TrainingPlanChangeCancel extends TrainingPlanEvent { List get props => [detail]; } -class TrainingPlanDeleteExerciseType extends TrainingPlanEvent { +class TrainingPlanAlternateChange extends TrainingPlanEvent { + final int index; final ExerciseType exerciseType; - const TrainingPlanDeleteExerciseType({required this.exerciseType}); + const TrainingPlanAlternateChange({required this.index, required this.exerciseType}); @override - List get props => [exerciseType]; -} - -class TrainingPlanCustomAddLoad extends TrainingPlanEvent { - final ExerciseType exerciseType; - const TrainingPlanCustomAddLoad({required this.exerciseType}); - - @override - List get props => [exerciseType]; + List get props => [index, exerciseType]; } class TrainingPlanFinishDropset extends TrainingPlanEvent { @@ -142,3 +135,19 @@ class TrainingPlanFinishDropset extends TrainingPlanEvent { @override List get props => [detail]; } + +class TrainingPlanAddLoad extends TrainingPlanEvent { + final ExerciseType exerciseType; + const TrainingPlanAddLoad({required this.exerciseType}); + + @override + List get props => [exerciseType]; +} + +class TrainingPlanDeleteExerciseType extends TrainingPlanEvent { + final ExerciseType exerciseType; + const TrainingPlanDeleteExerciseType({required this.exerciseType}); + + @override + List get props => [exerciseType]; +} diff --git a/lib/library/dropdown_search/dropdown_search.dart b/lib/library/dropdown_search/dropdown_search.dart index 14c315e..cc5f6dd 100644 --- a/lib/library/dropdown_search/dropdown_search.dart +++ b/lib/library/dropdown_search/dropdown_search.dart @@ -2,9 +2,7 @@ library dropdown_search; import 'dart:async'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/rendering.dart'; import 'popup_menu.dart'; import 'select_dialog.dart'; diff --git a/lib/library/dropdown_search/popup_menu.dart b/lib/library/dropdown_search/popup_menu.dart index f36c046..6cb1c4a 100644 --- a/lib/library/dropdown_search/popup_menu.dart +++ b/lib/library/dropdown_search/popup_menu.dart @@ -3,7 +3,6 @@ import 'dart:async'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; -import 'package:flutter/widgets.dart'; const Duration _kMenuDuration = Duration(milliseconds: 300); const double _kMenuCloseIntervalEnd = 2.0 / 3.0; diff --git a/lib/library/gradient_bottom_navigation_bar.dart b/lib/library/gradient_bottom_navigation_bar.dart index ee63338..2e8b5cb 100644 --- a/lib/library/gradient_bottom_navigation_bar.dart +++ b/lib/library/gradient_bottom_navigation_bar.dart @@ -8,7 +8,6 @@ import 'dart:collection' show Queue; import 'dart:math' as math; import 'package:flutter/material.dart'; -import 'package:flutter/widgets.dart'; import 'package:vector_math/vector_math_64.dart' show Vector3; const double _kActiveFontSize = 14.0; diff --git a/lib/library/radar_chart.dart b/lib/library/radar_chart.dart index 780812c..32c0696 100644 --- a/lib/library/radar_chart.dart +++ b/lib/library/radar_chart.dart @@ -1,6 +1,5 @@ library flutter_radar_chart; -import 'dart:ui'; import 'dart:math' as math; import 'package:flutter/material.dart'; diff --git a/lib/library/super_tooltip.dart b/lib/library/super_tooltip.dart index 1265837..859adae 100644 --- a/lib/library/super_tooltip.dart +++ b/lib/library/super_tooltip.dart @@ -2,7 +2,6 @@ import 'dart:math'; import 'dart:ui' as ui; import 'package:flutter/material.dart'; -import 'package:flutter/widgets.dart'; enum TooltipDirection { up, down, left, right } enum ShowCloseButton { inside, outside, none } diff --git a/lib/main.dart b/lib/main.dart index fc6b646..320cc02 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,3 +1,5 @@ +// ignore_for_file: must_be_immutable + import 'dart:async'; import 'dart:io'; import 'package:aitrainer_app/bloc/test_set_execute/test_set_execute_bloc.dart'; @@ -46,18 +48,16 @@ import 'package:aitrainer_app/view/training_plan_exercise.dart'; import 'package:aitrainer_app/widgets/home.dart'; import 'package:aitrainer_app/library/facebook_app_events/facebook_app_events.dart'; import 'package:firebase_analytics/firebase_analytics.dart'; -import 'package:firebase_analytics/observer.dart'; //import 'package:flurry_data/flurry_data.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -import 'package:flutter/widgets.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_localizations/flutter_localizations.dart'; import 'package:aitrainer_app/util/app_localization.dart'; import 'package:flutter_uxcam/flutter_uxcam.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:sentry_flutter/sentry_flutter.dart'; -import 'package:smartlook/smartlook.dart'; +import 'package:flutter_smartlook/flutter_smartlook.dart'; import 'package:upgrader/upgrader.dart'; import 'bloc/account/account_bloc.dart'; import 'bloc/body_development/body_development_bloc.dart'; @@ -144,6 +144,13 @@ Future main() async { }, ); } + Future initThirdParty() async { + if (!isInDebugMode) { + //await FlurryData.initialize(androidKey: "JNYCTCWBT34FM3J8TV36", iosKey: "3QBG7BSMGPDH24S8TRQP", enableLog: true); + FlutterUxcam.optIntoSchematicRecordings(); + } + await FirebaseApi().initializeFlutterFire(); + } final WorkoutTreeRepository menuTreeRepository = WorkoutTreeRepository(); WidgetsFlutterBinding.ensureInitialized(); @@ -152,7 +159,11 @@ Future main() async { SetupOptions options = (new SetupOptionsBuilder('682883e5cd71a46160c4f6ed070530ee593f49c6')).build(); Smartlook.setupAndStartRecording(options); + Smartlook.setEventTrackingMode(EventTrackingMode.FULL_TRACKING); } + await initThirdParty(); + final FirebaseAnalytics analytics = FirebaseAnalytics.instance; + ; print(" -- FireBase init.."); @@ -192,27 +203,22 @@ Future main() async { return TrainingPlanBloc(menuBloc: menuBloc, trainingPlanRepository: TrainingPlanRepository()); }), ], - child: WorkoutTestApp(), + child: WorkoutTestApp(analytics: analytics), )); }, (error, stackTrace) async { await _reportError(error, stackTrace); }); } -Future initThirdParty() async { - if (!isInDebugMode) { - //await FlurryData.initialize(androidKey: "JNYCTCWBT34FM3J8TV36", iosKey: "3QBG7BSMGPDH24S8TRQP", enableLog: true); - FlutterUxcam.optIntoSchematicRecordings(); - } - await FirebaseApi().initializeFlutterFire(); -} - class WorkoutTestApp extends StatelessWidget { + final FirebaseAnalytics analytics; + + const WorkoutTestApp({required this.analytics}); + static final facebookAppEvents = FacebookAppEvents(); @override Widget build(BuildContext context) { SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]); - final FirebaseAnalytics analytics = FirebaseAnalytics(); // Only call clearSavedSettings() during testing to reset internal values. Upgrader().clearSavedSettings(); // REMOVE this for release builds @@ -225,7 +231,6 @@ class WorkoutTestApp extends StatelessWidget { // valid identifier already in the App Store. //facebookAppEvents.setAdvertiserTracking(enabled: true); - initThirdParty(); return MaterialApp( localizationsDelegates: [ diff --git a/lib/model/cache.dart b/lib/model/cache.dart index b3aab14..5b3b35b 100644 --- a/lib/model/cache.dart +++ b/lib/model/cache.dart @@ -38,7 +38,7 @@ import 'package:package_info/package_info.dart'; import 'package:shared_preferences/shared_preferences.dart'; import 'package:aitrainer_app/model/exercise_type.dart'; import 'package:intl/intl.dart'; -import 'package:smartlook/smartlook.dart'; +import 'package:flutter_smartlook/flutter_smartlook.dart'; import 'customer_exercise_device.dart'; import 'exercise_device.dart'; diff --git a/lib/model/customer_training_plan_details.dart b/lib/model/customer_training_plan_details.dart index 0e75e9c..86b92ba 100644 --- a/lib/model/customer_training_plan_details.dart +++ b/lib/model/customer_training_plan_details.dart @@ -150,5 +150,13 @@ class CustomerTrainingPlanDetails { this.day = from.day; this.dayId = from.dayId; this.baseOneRepMax = from.baseOneRepMax; + if (from.exercises.length == 0) { + this.exercises = []; + } + if (from.alternatives.length > 0) { + from.alternatives.forEach((alternative) { + this.alternatives.add(alternative); + }); + } } } diff --git a/lib/repository/customer_repository.dart b/lib/repository/customer_repository.dart index f31024c..3ea7408 100644 --- a/lib/repository/customer_repository.dart +++ b/lib/repository/customer_repository.dart @@ -257,6 +257,12 @@ class CustomerRepository with Logging { Future saveCustomer() async { if (this.customer == null) throw Exception("Initialize the customer object"); final Customer modelCustomer = customer!; + if (modelCustomer.sex == null) { + modelCustomer.sex = "m"; + } + if (modelCustomer.fitnessLevel == null) { + modelCustomer.fitnessLevel = "beginner"; + } await CustomerApi().saveCustomer(modelCustomer); await this.saveProperties(modelCustomer.properties); } diff --git a/lib/repository/evaluation_repository.dart b/lib/repository/evaluation_repository.dart index 2c85301..390f524 100644 --- a/lib/repository/evaluation_repository.dart +++ b/lib/repository/evaluation_repository.dart @@ -4,7 +4,6 @@ import 'package:aitrainer_app/model/evaluation.dart'; import 'package:aitrainer_app/model/evaluation_attribute.dart'; import 'package:aitrainer_app/util/enums.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/widgets.dart'; class EvaluationRepository { List? evaluations; diff --git a/lib/repository/exercise_plan_repository.dart b/lib/repository/exercise_plan_repository.dart index b0d4092..64c7f66 100644 --- a/lib/repository/exercise_plan_repository.dart +++ b/lib/repository/exercise_plan_repository.dart @@ -166,7 +166,7 @@ class ExercisePlanRepository { if (exercisePlan == null) { this.createNewPlan(); } - ; + Cache().setMyExercisePlan(exercisePlan!); return exercisePlan; } diff --git a/lib/repository/training_plan_repository.dart b/lib/repository/training_plan_repository.dart index 70e2d3e..8d6d653 100644 --- a/lib/repository/training_plan_repository.dart +++ b/lib/repository/training_plan_repository.dart @@ -6,6 +6,7 @@ import 'package:aitrainer_app/model/exercise_plan_detail.dart'; import 'package:aitrainer_app/model/exercise_tree.dart'; import 'package:aitrainer_app/model/fitness_state.dart'; import 'package:aitrainer_app/model/training_plan.dart'; +import 'package:aitrainer_app/model/training_plan_detail.dart'; import 'package:aitrainer_app/repository/training_plan_day_repository.dart'; import 'package:aitrainer_app/util/app_language.dart'; import 'package:aitrainer_app/util/common.dart'; @@ -69,9 +70,13 @@ class TrainingPlanRepository { // 3 calculate weights int index = 0; - + int exerciseTypeIdOrig = 0; trainingPlan.details!.forEach((elem) { - CustomerTrainingPlanDetails detail = CustomerTrainingPlanDetails(); + List list = createDetail(plan, elem, exerciseTypeIdOrig, index); + list.forEach((element) { + plan.details.add(element); + }); + /* CustomerTrainingPlanDetails detail = CustomerTrainingPlanDetails(); detail.customerTrainingPlanDetailsId = ++index; detail.trainingPlanDetailsId = elem.trainingPlanDetailId; detail.exerciseTypeId = elem.exerciseTypeId; @@ -107,7 +112,25 @@ class TrainingPlanRepository { detail.baseOneRepMax = Common.calculate1RM(detail.weight!, detail.repeats!.toDouble()); } detail.alternatives = Common.getExerciseTypeAlternatives(detail.exerciseTypeId); - plan.details.add(detail); + + // first repeat: 50% more + if (detail.weight != null && detail.weight! > 0 && exerciseTypeIdOrig != detail.exerciseTypeId && detail.repeats! > 0) { + CustomerTrainingPlanDetails firstDetail = CustomerTrainingPlanDetails(); + firstDetail.copy(detail); + firstDetail.repeats = (detail.repeats! * 1.5).round(); + firstDetail.set = 1; + detail.set = detail.set! - 1; + if (detail.set! > 0) { + index++; + } + detail.customerTrainingPlanDetailsId = index; + plan.details.add(firstDetail); + exerciseTypeIdOrig = detail.exerciseTypeId!; + } + + if (detail.set! > 0) { + plan.details.add(detail); + } */ }); Cache().myTrainingPlan = plan; @@ -116,6 +139,68 @@ class TrainingPlanRepository { return plan; } + List createDetail(CustomerTrainingPlan plan, TrainingPlanDetail elem, int exerciseTypeIdOrig, int index, + {bool changeExerciseType = false}) { + List list = []; + CustomerTrainingPlanDetails detail = CustomerTrainingPlanDetails(); + detail.customerTrainingPlanDetailsId = ++index; + detail.trainingPlanDetailsId = elem.trainingPlanDetailId; + detail.exerciseTypeId = changeExerciseType ? exerciseTypeIdOrig : elem.exerciseTypeId; + detail.repeats = elem.repeats; + detail.set = elem.set; + detail.dayId = elem.dayId; + TrainingPlanDayRepository trainingPlanDayRepository = TrainingPlanDayRepository(); + detail.day = trainingPlanDayRepository.getNameById(elem.dayId); + detail.parallel = elem.parallel; + detail.restingTime = elem.restingTime; + detail.exerciseType = Cache().getExerciseTypeById(detail.exerciseTypeId!); + detail.alternatives = Common.getExerciseTypeAlternatives(detail.exerciseTypeId); + if (elem.weight == -1) { + if (detail.exerciseType!.unitQuantityUnit != null) { + detail = getCalculatedWeightRepeats(elem.exerciseTypeId, detail); + } else { + detail.weight = 0; + } + } else if (elem.weight == -2) { + final CustomerTrainingPlanDetails calculated = this.isWeightCalculatedByExerciseType(elem.exerciseTypeId, detail, plan); + if (calculated.weight != -1) { + detail.weight = calculated.weight; + } else { + detail.weight = -2; + } + } else { + detail.weight = elem.weight; + } + print("Detail $detail exerciseType: ${detail.exerciseType!.exerciseTypeId}"); + + detail.state = ExercisePlanDetailState.start; + if (detail.weight != null && detail.weight! > 0) { + detail.baseOneRepMax = Common.calculate1RM(detail.weight!, detail.repeats!.toDouble()); + } + + // first repeat: 50% more + if (detail.weight != null && detail.weight! > 0 && exerciseTypeIdOrig != detail.exerciseTypeId && detail.repeats! > 0) { + CustomerTrainingPlanDetails firstDetail = CustomerTrainingPlanDetails(); + firstDetail.copy(detail); + firstDetail.repeats = (detail.repeats! * 1.5).round(); + firstDetail.set = 1; + detail.set = detail.set! - 1; + if (detail.set! > 0) { + index++; + } + detail.customerTrainingPlanDetailsId = index; + //plan.details.add(firstDetail); + list.add(firstDetail); + exerciseTypeIdOrig = detail.exerciseTypeId!; + } + + if (detail.set! > 0) { + //plan.details.add(detail); + list.add(detail); + } + return list; + } + CustomerTrainingPlanDetails isWeightCalculatedByExerciseType( int exerciseTypeId, CustomerTrainingPlanDetails detail, CustomerTrainingPlan plan) { CustomerTrainingPlanDetails calculated = detail; @@ -172,10 +257,16 @@ class TrainingPlanRepository { Exercise? lastExercise1RM; DateTime dt = DateTime.now().subtract(Duration(days: 30)); - Cache().getExercises()!.forEach((exercise) { + List exercises = Cache().getExercises()!; + exercises.sort((a, b) { + // reverse + return a.dateAdd!.compareTo(b.dateAdd!); + }); + exercises.forEach((exercise) { if (exercise.exerciseTypeId == exerciseTypeId && exercise.dateAdd!.compareTo(dt) >= 0) { detail.weight = weight; lastExercise1RM = exercise; + print("last exercise: $exercise"); } }); @@ -185,7 +276,8 @@ class TrainingPlanRepository { return detail; } - double oneRepMax = Common.calculate1RM(lastExercise1RM!.unitQuantity!, lastExercise1RM!.quantity!); + double oneRepMax = calculateMax1RMSameDay(lastExercise1RM!); + // Common.calculate1RM(lastExercise1RM!.unitQuantity!, lastExercise1RM!.quantity!); print("Exercise $exerciseTypeId - 1RM : $oneRepMax"); weight = oneRepMax * Common.get1RMPercent(detail.repeats!); print("Exercise $exerciseTypeId - weight : $weight"); @@ -201,6 +293,25 @@ class TrainingPlanRepository { return detail; } + double calculateMax1RMSameDay(Exercise actual) { + List exercises = Cache().getExercises()!; + double max1RM = 0.0; + + exercises.forEach((exercise) { + if (actual.exerciseTypeId == exercise.exerciseTypeId && + actual.dateAdd!.year == exercise.dateAdd!.year && + actual.dateAdd!.month == exercise.dateAdd!.month && + actual.dateAdd!.day == exercise.dateAdd!.day) { + double oneRepMax = Common.calculate1RM(exercise.unitQuantity!, exercise.quantity!); + if (max1RM < oneRepMax) { + max1RM = oneRepMax; + } + } + }); + + return max1RM; + } + int getOriginalRepeats(int trainingPlanId, CustomerTrainingPlanDetails detail) { TrainingPlan? plan = getTrainingPlanById(trainingPlanId); if (plan == null) { diff --git a/lib/service/api.dart b/lib/service/api.dart index 608f72d..b3109f1 100644 --- a/lib/service/api.dart +++ b/lib/service/api.dart @@ -7,13 +7,28 @@ import 'package:flutter/services.dart'; import 'package:aitrainer_app/model/cache.dart'; class APIClient with Common, Logging { + static final APIClient _singleton = APIClient._internal(); + late bool cert; + + factory APIClient() { + return _singleton; + } + + APIClient._internal() { + cert = false; + } + dynamic authenticateUser(String email, String password) async { var url = Cache().getBaseUrl() + "authenticate"; try { ByteData data = await rootBundle.load('asset/data/aitrainer_server.crt.pem'); SecurityContext context = SecurityContext.defaultContext; - context.setTrustedCertificatesBytes(data.buffer.asUint8List(), password: "[xxxx]"); + if (cert == false) { + print("Set CERT $cert"); + context.setTrustedCertificatesBytes(data.buffer.asUint8List(), password: "[xxxx]"); + cert = true; + } HttpClient client = new HttpClient(); //context: context Todo provide the right certificate client.badCertificateCallback = ((X509Certificate cert, String host, int port) { @@ -52,7 +67,9 @@ class APIClient with Common, Logging { } var uri = Uri.parse(url); HttpClient client = new HttpClient(); + client.badCertificateCallback = ((X509Certificate cert, String host, int port) => true); + final HttpClientRequest request = await client.postUrl(uri); request.headers.contentType = new ContentType("application", "json", charset: "utf-8"); request.headers.set('Authorization', 'Bearer $authToken'); @@ -87,7 +104,9 @@ class APIClient with Common, Logging { var uri = Uri.parse(url); HttpClient client = new HttpClient(); + client.badCertificateCallback = ((X509Certificate cert, String host, int port) => true); + final HttpClientRequest request = await client.getUrl(uri); request.headers.set('Content-Type', 'application/json'); request.headers.set('Authorization', 'Bearer $authToken'); diff --git a/lib/service/customer_exercise_device_service.dart b/lib/service/customer_exercise_device_service.dart index 14327d2..6d6d9af 100644 --- a/lib/service/customer_exercise_device_service.dart +++ b/lib/service/customer_exercise_device_service.dart @@ -6,7 +6,7 @@ import 'dart:convert'; import 'api.dart'; class CustomerExerciseDeviceApi with Logging { - final APIClient _client = new APIClient(); + final APIClient _client = APIClient(); Future> getDevices(int customerId) async { List devices = []; diff --git a/lib/service/customer_service.dart b/lib/service/customer_service.dart index cd69cad..2f3e684 100644 --- a/lib/service/customer_service.dart +++ b/lib/service/customer_service.dart @@ -10,7 +10,7 @@ import 'package:aitrainer_app/service/logging.dart'; import 'package:aitrainer_app/util/not_found_exception.dart'; class CustomerApi with Logging { - final APIClient _client = new APIClient(); + final APIClient _client = APIClient(); Future> getRealCustomers(String param) async { final body = await _client.get("customers/", param); diff --git a/lib/service/exercise_device_service.dart b/lib/service/exercise_device_service.dart index 4b15433..811bb74 100644 --- a/lib/service/exercise_device_service.dart +++ b/lib/service/exercise_device_service.dart @@ -5,7 +5,7 @@ import 'package:aitrainer_app/model/exercise_device.dart'; import 'api.dart'; class ExerciseDeviceApi { - final APIClient _client = new APIClient(); + final APIClient _client = APIClient(); Future> getDevices() async { final body = await _client.get("exercise_device/", ""); diff --git a/lib/service/exercise_plan_service.dart b/lib/service/exercise_plan_service.dart index 181cfac..f7dffce 100644 --- a/lib/service/exercise_plan_service.dart +++ b/lib/service/exercise_plan_service.dart @@ -6,7 +6,7 @@ import 'dart:convert'; import 'api.dart'; class ExercisePlanApi with Logging { - final APIClient _client = new APIClient(); + final APIClient _client = APIClient(); Future saveExercisePlan(ExercisePlan exercisePlan) async { String body = JsonEncoder().convert(exercisePlan.toJson()); diff --git a/lib/service/exercise_result_service.dart b/lib/service/exercise_result_service.dart index 0ff7288..ca1409a 100644 --- a/lib/service/exercise_result_service.dart +++ b/lib/service/exercise_result_service.dart @@ -6,7 +6,7 @@ import 'package:aitrainer_app/service/logging.dart'; import 'api.dart'; class ExerciseResultApi with Logging { - final APIClient _client = new APIClient(); + final APIClient _client = APIClient(); Future saveExerciseResult(ExerciseResult exerciseResult) async { String body = JsonEncoder().convert(exerciseResult.toJson()); diff --git a/lib/service/exercise_service.dart b/lib/service/exercise_service.dart index 9a71846..11e7cfc 100644 --- a/lib/service/exercise_service.dart +++ b/lib/service/exercise_service.dart @@ -4,7 +4,7 @@ import 'package:aitrainer_app/service/api.dart'; import 'package:aitrainer_app/service/logging.dart'; class ExerciseApi with Logging { - final APIClient _client = new APIClient(); + final APIClient _client = APIClient(); Future saveExercise(Exercise exercise) async { String body = JsonEncoder().convert(exercise.toJson()); diff --git a/lib/service/exercise_tree_service.dart b/lib/service/exercise_tree_service.dart index e828a95..0d15fef 100644 --- a/lib/service/exercise_tree_service.dart +++ b/lib/service/exercise_tree_service.dart @@ -8,7 +8,7 @@ import 'package:flutter/services.dart'; import 'api.dart'; class ExerciseTreeApi with Logging { - final APIClient _client = new APIClient(); + final APIClient _client = APIClient(); Future> getExerciseTree() async { final String body = await _client.get("exercise_tree", ""); diff --git a/lib/service/exercise_type_service.dart b/lib/service/exercise_type_service.dart index 2688516..93d2d68 100644 --- a/lib/service/exercise_type_service.dart +++ b/lib/service/exercise_type_service.dart @@ -6,7 +6,7 @@ import 'package:aitrainer_app/service/logging.dart'; import 'package:flutter/services.dart'; class ExerciseTypeApi with Logging { - final APIClient _client = new APIClient(); + final APIClient _client = APIClient(); Future> getExerciseTypes() async { final body = await _client.get("exercise_type", ""); diff --git a/lib/service/package_service.dart b/lib/service/package_service.dart index 32e0477..7e17ee9 100644 --- a/lib/service/package_service.dart +++ b/lib/service/package_service.dart @@ -31,7 +31,7 @@ import 'customer_service.dart'; import 'exercise_tree_service.dart'; class PackageApi { - final APIClient _client = new APIClient(); + final APIClient _client = APIClient(); Future getPackage() async { late List exerciseTree; diff --git a/lib/service/product_service.dart b/lib/service/product_service.dart index 99b1ccc..2e108be 100644 --- a/lib/service/product_service.dart +++ b/lib/service/product_service.dart @@ -5,7 +5,7 @@ import 'package:aitrainer_app/model/product.dart'; import 'package:aitrainer_app/service/api.dart'; class ProductApi { - final APIClient _client = new APIClient(); + final APIClient _client = APIClient(); Future> getProducts() async { final body = await _client.get("product/", ""); diff --git a/lib/service/property_service.dart b/lib/service/property_service.dart index a5f4a4b..322982c 100644 --- a/lib/service/property_service.dart +++ b/lib/service/property_service.dart @@ -6,7 +6,7 @@ import 'package:aitrainer_app/service/api.dart'; import '../model/property.dart'; class PropertyApi { - final APIClient _client = new APIClient(); + final APIClient _client = APIClient(); Future> getProperties() async { final body = await _client.get("property/", ""); diff --git a/lib/service/purchase_service.dart b/lib/service/purchase_service.dart index f93980b..7d0a436 100644 --- a/lib/service/purchase_service.dart +++ b/lib/service/purchase_service.dart @@ -6,7 +6,7 @@ import 'dart:convert'; import 'api.dart'; class PurchaseApi with Logging { - final APIClient _client = new APIClient(); + final APIClient _client = APIClient(); Future> getPurchasesByCustomer(int customerId) async { List purchases = []; diff --git a/lib/service/sport_service.dart b/lib/service/sport_service.dart index a725ff6..bdbbb06 100644 --- a/lib/service/sport_service.dart +++ b/lib/service/sport_service.dart @@ -6,7 +6,7 @@ import 'package:aitrainer_app/service/api.dart'; import '../model/sport.dart'; class SportApi { - final APIClient _client = new APIClient(); + final APIClient _client = APIClient(); Future> getSports() async { final body = await _client.get("sports/", ""); diff --git a/lib/service/tracking_service.dart b/lib/service/tracking_service.dart index 57b652d..a9513b5 100644 --- a/lib/service/tracking_service.dart +++ b/lib/service/tracking_service.dart @@ -4,7 +4,7 @@ import 'dart:convert'; import 'api.dart'; class TrackingApi with Logging { - final APIClient _client = new APIClient(); + final APIClient _client = APIClient(); Future saveTracking(Tracking tracking) async { try { diff --git a/lib/service/training_plan_service.dart b/lib/service/training_plan_service.dart index e0c2667..6b35373 100644 --- a/lib/service/training_plan_service.dart +++ b/lib/service/training_plan_service.dart @@ -6,7 +6,7 @@ import 'package:aitrainer_app/service/api.dart'; import 'package:aitrainer_app/service/logging.dart'; class TrainingPlanApi with Logging { - final APIClient _client = new APIClient(); + final APIClient _client = APIClient(); Future saveCustomerTrainingPlan(CustomerTrainingPlan plan) async { String body = JsonEncoder().convert(plan.toJson()); diff --git a/lib/util/app_localization.dart b/lib/util/app_localization.dart index 8e2486d..e0c9845 100644 --- a/lib/util/app_localization.dart +++ b/lib/util/app_localization.dart @@ -1,5 +1,4 @@ import 'dart:convert'; -import 'dart:ui'; import 'package:aitrainer_app/service/logging.dart'; import 'package:flutter/cupertino.dart'; diff --git a/lib/util/common.dart b/lib/util/common.dart index ce4d149..8e46a42 100644 --- a/lib/util/common.dart +++ b/lib/util/common.dart @@ -4,7 +4,6 @@ import 'package:aitrainer_app/model/cache.dart'; import 'package:aitrainer_app/model/exercise_type.dart'; import 'package:aitrainer_app/repository/user_repository.dart'; import 'package:badges/badges.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:intl/intl.dart'; diff --git a/lib/util/track.dart b/lib/util/track.dart index 1174638..fa3799a 100644 --- a/lib/util/track.dart +++ b/lib/util/track.dart @@ -8,11 +8,11 @@ import 'package:firebase_analytics/firebase_analytics.dart'; import 'package:firebase_messaging/firebase_messaging.dart'; //import 'package:flurry_data/flurry_data.dart'; import 'package:flutter_uxcam/flutter_uxcam.dart'; -import 'package:smartlook/smartlook.dart'; +import 'package:flutter_smartlook/flutter_smartlook.dart'; class Track with Logging { static final Track _singleton = Track._internal(); - static FirebaseAnalytics analytics = FirebaseAnalytics(); + static FirebaseAnalytics analytics = FirebaseAnalytics.instance; factory Track() { return _singleton; diff --git a/lib/view/account.dart b/lib/view/account.dart index fbc7c8d..ff26a48 100644 --- a/lib/view/account.dart +++ b/lib/view/account.dart @@ -183,7 +183,7 @@ class AccountPage extends StatelessWidget with Trans { } ListTile messaging() { - FirebaseInAppMessaging fiam = FirebaseInAppMessaging(); + FirebaseInAppMessaging fiam = FirebaseInAppMessaging.instance; ListTile element = ListTile( leading: Icon(Icons.message), title: TextButton( diff --git a/lib/view/customer_bodytype_animation.dart b/lib/view/customer_bodytype_animation.dart index 8a31e82..a1a1d44 100644 --- a/lib/view/customer_bodytype_animation.dart +++ b/lib/view/customer_bodytype_animation.dart @@ -1,12 +1,10 @@ import 'dart:collection'; -import 'dart:ui'; import 'package:aitrainer_app/bloc/body_type/bodytype_bloc.dart'; import 'package:aitrainer_app/util/app_localization.dart'; import 'package:aitrainer_app/repository/customer_repository.dart'; import 'package:aitrainer_app/util/enums.dart'; import 'package:aitrainer_app/util/trans.dart'; -import 'package:aitrainer_app/widgets/app_bar.dart'; import 'package:aitrainer_app/widgets/app_bar_min.dart'; import 'package:aitrainer_app/widgets/dialog_html.dart'; import 'package:flutter/material.dart'; diff --git a/lib/view/customer_exercise_device.dart b/lib/view/customer_exercise_device.dart index cfb9502..f13b7a0 100644 --- a/lib/view/customer_exercise_device.dart +++ b/lib/view/customer_exercise_device.dart @@ -6,7 +6,6 @@ import 'package:aitrainer_app/repository/customer_exercise_device_repository.dar import 'package:aitrainer_app/util/trans.dart'; import 'package:aitrainer_app/widgets/app_bar.dart'; import 'package:aitrainer_app/widgets/image_button.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:google_fonts/google_fonts.dart'; diff --git a/lib/view/customer_fitness_page.dart b/lib/view/customer_fitness_page.dart index 2d60569..086428d 100644 --- a/lib/view/customer_fitness_page.dart +++ b/lib/view/customer_fitness_page.dart @@ -8,9 +8,7 @@ import 'package:aitrainer_app/model/fitness_state.dart'; import 'package:aitrainer_app/util/trans.dart'; import 'package:aitrainer_app/widgets/app_bar_min.dart'; import 'package:aitrainer_app/widgets/app_bar_progress.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/rendering.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:modal_progress_hud_nsn/modal_progress_hud_nsn.dart'; @@ -52,7 +50,6 @@ class _CustomerFitnessPageState extends State with Trans { if (!fulldata) { _bar = AppBarProgress(max: 30, min: 15); } - final double h = 27; return Scaffold( appBar: _bar, body: Container( diff --git a/lib/view/customer_goal_page.dart b/lib/view/customer_goal_page.dart index 3426630..c154065 100644 --- a/lib/view/customer_goal_page.dart +++ b/lib/view/customer_goal_page.dart @@ -6,7 +6,6 @@ import 'package:aitrainer_app/repository/customer_repository.dart'; import 'package:aitrainer_app/util/trans.dart'; import 'package:aitrainer_app/widgets/app_bar_min.dart'; import 'package:aitrainer_app/widgets/app_bar_progress.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:google_fonts/google_fonts.dart'; diff --git a/lib/view/customer_height_page.dart b/lib/view/customer_height_page.dart index 4de4076..fd677c6 100644 --- a/lib/view/customer_height_page.dart +++ b/lib/view/customer_height_page.dart @@ -5,9 +5,7 @@ import 'package:aitrainer_app/repository/customer_repository.dart'; import 'package:aitrainer_app/util/trans.dart'; import 'package:aitrainer_app/widgets/app_bar_min.dart'; import 'package:aitrainer_app/widgets/app_bar_progress.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/rendering.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:google_fonts/google_fonts.dart'; diff --git a/lib/view/customer_modify_page.dart b/lib/view/customer_modify_page.dart index 1414958..8af69cd 100644 --- a/lib/view/customer_modify_page.dart +++ b/lib/view/customer_modify_page.dart @@ -13,8 +13,6 @@ import 'package:aitrainer_app/widgets/app_bar_min.dart'; import 'package:aitrainer_app/widgets/app_bar_progress.dart'; import 'package:aitrainer_app/widgets/number_picker.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter/widgets.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:modal_progress_hud_nsn/modal_progress_hud_nsn.dart'; diff --git a/lib/view/customer_sex_page.dart b/lib/view/customer_sex_page.dart index 55a9178..0f4afec 100644 --- a/lib/view/customer_sex_page.dart +++ b/lib/view/customer_sex_page.dart @@ -6,9 +6,7 @@ import 'package:aitrainer_app/repository/customer_repository.dart'; import 'package:aitrainer_app/util/trans.dart'; import 'package:aitrainer_app/widgets/app_bar_min.dart'; import 'package:aitrainer_app/widgets/app_bar_progress.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/rendering.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:modal_progress_hud_nsn/modal_progress_hud_nsn.dart'; diff --git a/lib/view/customer_weight_page.dart b/lib/view/customer_weight_page.dart index 1f5bd2d..ad1bcc0 100644 --- a/lib/view/customer_weight_page.dart +++ b/lib/view/customer_weight_page.dart @@ -6,9 +6,7 @@ import 'package:aitrainer_app/util/trans.dart'; import 'package:aitrainer_app/widgets/app_bar_min.dart'; import 'package:aitrainer_app/widgets/app_bar_progress.dart'; import 'package:aitrainer_app/widgets/number_picker.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/rendering.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:modal_progress_hud_nsn/modal_progress_hud_nsn.dart'; diff --git a/lib/view/evaluation_page.dart b/lib/view/evaluation_page.dart index 8163004..3ee7993 100644 --- a/lib/view/evaluation_page.dart +++ b/lib/view/evaluation_page.dart @@ -1,5 +1,4 @@ import 'dart:collection'; -import 'dart:ui'; import 'package:aitrainer_app/bloc/tutorial/tutorial_bloc.dart'; import 'package:aitrainer_app/widgets/tutorial_widget.dart'; import 'package:intl/intl.dart'; diff --git a/lib/view/exercise_control_page.dart b/lib/view/exercise_control_page.dart index c6d763f..94ee6d9 100644 --- a/lib/view/exercise_control_page.dart +++ b/lib/view/exercise_control_page.dart @@ -12,7 +12,6 @@ import 'package:aitrainer_app/widgets/dialog_html.dart'; import 'package:aitrainer_app/widgets/number_picker.dart'; import 'package:aitrainer_app/widgets/timer_widget.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:modal_progress_hud_nsn/modal_progress_hud_nsn.dart'; diff --git a/lib/view/faq_page.dart b/lib/view/faq_page.dart index 9b1ab8f..f6e2460 100644 --- a/lib/view/faq_page.dart +++ b/lib/view/faq_page.dart @@ -8,7 +8,6 @@ import 'package:aitrainer_app/widgets/treeview_parent_widget.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_html/flutter_html.dart'; -import 'package:flutter_html/style.dart'; import 'package:modal_progress_hud_nsn/modal_progress_hud_nsn.dart'; // ignore: must_be_immutable diff --git a/lib/view/login.dart b/lib/view/login.dart index 2daa973..d2174a1 100644 --- a/lib/view/login.dart +++ b/lib/view/login.dart @@ -8,7 +8,6 @@ import 'package:aitrainer_app/widgets/app_bar_min.dart'; import 'package:aitrainer_app/widgets/dialog_common.dart'; import 'package:aitrainer_app/widgets/dialog_web_browser.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:modal_progress_hud_nsn/modal_progress_hud_nsn.dart'; diff --git a/lib/view/menu_page.dart b/lib/view/menu_page.dart index 24299e3..4388ed3 100644 --- a/lib/view/menu_page.dart +++ b/lib/view/menu_page.dart @@ -3,7 +3,6 @@ import 'package:aitrainer_app/bloc/menu/menu_bloc.dart'; import 'package:aitrainer_app/widgets/app_bar.dart'; import 'package:aitrainer_app/widgets/bottom_nav.dart'; import 'package:aitrainer_app/widgets/menu_page_widget.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; diff --git a/lib/view/mydevelopment_log.dart b/lib/view/mydevelopment_log.dart index 5338419..271eb59 100644 --- a/lib/view/mydevelopment_log.dart +++ b/lib/view/mydevelopment_log.dart @@ -99,7 +99,7 @@ class MyDevelopmentLog extends StatelessWidget with Trans, Common { view: CalendarView.month, monthViewSettings: MonthViewSettings( showAgenda: true, - appointmentDisplayMode: MonthAppointmentDisplayMode.appointment, + appointmentDisplayMode: MonthAppointmentDisplayMode.indicator, showTrailingAndLeadingDates: true, ), appointmentTimeTextFormat: 'HH:mm', @@ -307,11 +307,11 @@ class MyDevelopmentLog extends StatelessWidget with Trans, Common { TextSpan(text: t("The found exercises are")), TextSpan(text: " "), TextSpan( - text: t("in red"), + text: t("in green"), style: GoogleFonts.inter( fontSize: 14, fontWeight: FontWeight.normal, - color: Colors.redAccent, + color: Color(0xffb4f500), ), ), TextSpan(text: " "), diff --git a/lib/view/mydevelopment_muscle_page.dart b/lib/view/mydevelopment_muscle_page.dart index f507bee..8bab817 100644 --- a/lib/view/mydevelopment_muscle_page.dart +++ b/lib/view/mydevelopment_muscle_page.dart @@ -11,9 +11,7 @@ import 'package:aitrainer_app/bloc/development_by_muscle/development_by_muscle_b import 'package:aitrainer_app/model/workout_menu_tree.dart'; import 'package:aitrainer_app/library/tree_view.dart'; import 'package:aitrainer_app/widgets/bottom_nav.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/rendering.dart'; import 'package:flutter/scheduler.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; diff --git a/lib/view/mydevelopment_page.dart b/lib/view/mydevelopment_page.dart index 33e21bf..b18fa07 100644 --- a/lib/view/mydevelopment_page.dart +++ b/lib/view/mydevelopment_page.dart @@ -14,7 +14,6 @@ import 'package:aitrainer_app/util/trans.dart'; import 'package:aitrainer_app/widgets/app_bar.dart'; import 'package:aitrainer_app/widgets/bottom_nav.dart'; import 'package:aitrainer_app/widgets/image_button.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; class MyDevelopmentPage extends StatefulWidget { diff --git a/lib/view/mydevelopment_sizes_page.dart b/lib/view/mydevelopment_sizes_page.dart index 833eec0..eb77b96 100644 --- a/lib/view/mydevelopment_sizes_page.dart +++ b/lib/view/mydevelopment_sizes_page.dart @@ -2,9 +2,7 @@ import 'package:aitrainer_app/bloc/development_sizes/development_sizes_bloc.dart import 'package:aitrainer_app/model/property.dart'; import 'package:aitrainer_app/repository/customer_repository.dart'; import 'package:aitrainer_app/util/trans.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/widgets.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:modal_progress_hud_nsn/modal_progress_hud_nsn.dart'; diff --git a/lib/view/registration.dart b/lib/view/registration.dart index 85195a0..b2da9b9 100644 --- a/lib/view/registration.dart +++ b/lib/view/registration.dart @@ -10,7 +10,6 @@ import 'package:aitrainer_app/widgets/app_bar_min.dart'; import 'package:aitrainer_app/widgets/dialog_common.dart'; import 'package:aitrainer_app/widgets/dialog_web_browser.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:modal_progress_hud_nsn/modal_progress_hud_nsn.dart'; diff --git a/lib/view/reset_password.dart b/lib/view/reset_password.dart index 114565b..8b636ce 100644 --- a/lib/view/reset_password.dart +++ b/lib/view/reset_password.dart @@ -3,7 +3,6 @@ import 'package:aitrainer_app/repository/user_repository.dart'; import 'package:aitrainer_app/util/trans.dart'; import 'package:aitrainer_app/widgets/app_bar_min.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:modal_progress_hud_nsn/modal_progress_hud_nsn.dart'; diff --git a/lib/view/sales_page.dart b/lib/view/sales_page.dart index fca40c8..6bc714e 100644 --- a/lib/view/sales_page.dart +++ b/lib/view/sales_page.dart @@ -4,11 +4,9 @@ import 'package:aitrainer_app/service/logging.dart'; import 'package:aitrainer_app/util/trans.dart'; import 'package:aitrainer_app/widgets/app_bar_min.dart'; import 'package:aitrainer_app/widgets/dialog_common.dart'; -import 'package:aitrainer_app/widgets/sales_button.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_html/flutter_html.dart'; -import 'package:flutter_html/style.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:modal_progress_hud_nsn/modal_progress_hud_nsn.dart'; diff --git a/lib/view/settings.dart b/lib/view/settings.dart index e67760d..2f45200 100644 --- a/lib/view/settings.dart +++ b/lib/view/settings.dart @@ -12,7 +12,6 @@ import 'package:aitrainer_app/widgets/app_bar_min.dart'; import 'package:aitrainer_app/widgets/bottom_nav.dart'; import 'package:aitrainer_app/widgets/dialog_web_browser.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:modal_progress_hud_nsn/modal_progress_hud_nsn.dart'; diff --git a/lib/view/training_plan_activate_page.dart b/lib/view/training_plan_activate_page.dart index 8d6896a..8172538 100644 --- a/lib/view/training_plan_activate_page.dart +++ b/lib/view/training_plan_activate_page.dart @@ -20,7 +20,6 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_html/flutter_html.dart'; -import 'package:flutter_html/style.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:modal_progress_hud_nsn/modal_progress_hud_nsn.dart'; import 'package:syncfusion_flutter_datagrid/datagrid.dart'; diff --git a/lib/view/training_plan_custom.dart b/lib/view/training_plan_custom.dart index 7bdcdc0..76230ac 100644 --- a/lib/view/training_plan_custom.dart +++ b/lib/view/training_plan_custom.dart @@ -1,5 +1,3 @@ -import 'dart:collection'; - import 'package:aitrainer_app/bloc/training_plan/training_plan_bloc.dart'; import 'package:aitrainer_app/library/custom_icon_icons.dart'; import 'package:aitrainer_app/model/customer_training_plan.dart'; @@ -185,7 +183,7 @@ class _ExerciseTileState extends State with Trans { } void activateCustomPlan() { - widget.bloc.add(TrainingPlanCustomAddLoad(exerciseType: widget.exerciseType)); + widget.bloc.add(TrainingPlanAddLoad(exerciseType: widget.exerciseType)); Navigator.of(context).popAndPushNamed("myTrainingPlanCustomAdd"); } diff --git a/lib/view/training_plan_custom_add.dart b/lib/view/training_plan_custom_add.dart index 9349b53..71dbc76 100644 --- a/lib/view/training_plan_custom_add.dart +++ b/lib/view/training_plan_custom_add.dart @@ -3,12 +3,9 @@ import 'package:aitrainer_app/util/app_language.dart'; import 'package:aitrainer_app/util/trans.dart'; import 'package:aitrainer_app/widgets/app_bar_min.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:keyboard_actions/keyboard_actions.dart'; -import 'package:keyboard_actions/keyboard_actions_config.dart'; -import 'package:keyboard_actions/keyboard_actions_item.dart'; import 'package:modal_progress_hud_nsn/modal_progress_hud_nsn.dart'; class TrainingPlanCustomAddPage extends StatefulWidget { diff --git a/lib/view/training_plan_execute.dart b/lib/view/training_plan_execute.dart index 131c528..6fa9db8 100644 --- a/lib/view/training_plan_execute.dart +++ b/lib/view/training_plan_execute.dart @@ -5,6 +5,7 @@ import 'package:aitrainer_app/library/custom_icon_icons.dart'; import 'package:aitrainer_app/model/customer_training_plan_details.dart'; import 'package:aitrainer_app/model/exercise_plan_detail.dart'; import 'package:aitrainer_app/util/app_localization.dart'; +import 'package:aitrainer_app/util/common.dart'; import 'package:aitrainer_app/util/trans.dart'; import 'package:aitrainer_app/widgets/app_bar.dart'; import 'package:aitrainer_app/widgets/dialog_common.dart'; @@ -12,6 +13,7 @@ import 'package:aitrainer_app/widgets/dialog_html.dart'; import 'package:aitrainer_app/widgets/menu_image.dart'; import 'package:badges/badges.dart'; +import 'package:carousel_slider/carousel_slider.dart'; import 'package:extended_tabs/extended_tabs.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -312,7 +314,6 @@ class _ExerciseListState extends State with Trans { void animate() { offset = widget.bloc.getOffset(); - //print("Offset: $offset"); if (scrollController.hasClients) { scrollController.animateTo(offset, duration: Duration(milliseconds: 300), curve: Curves.easeIn); } @@ -390,7 +391,10 @@ class _ExerciseListState extends State with Trans { tiles.add(GestureDetector( onTap: () => bloc.getNext() != null ? executeExercise(bloc, bloc.getNext()!, context) : Navigator.of(context).pushNamed('home'), - child: ExerciseTile(bloc: bloc, detail: element))); + child: ExerciseTile( + bloc: bloc, + detail: element, + ))); } prev = element; }); @@ -407,10 +411,9 @@ class ExerciseTile extends StatelessWidget with Trans { ExerciseTile({required this.bloc, required this.detail}); - Widget getExerciseQuantities(CustomerTrainingPlanDetails detail, int step, bool noFilter) { + Widget getExerciseQuantities(CustomerTrainingPlanDetails detail, int step, bool noFilter, int highlightStep) { bool skipped = detail.state == ExercisePlanDetailState.skipped; String quantities = ""; - String set = ""; List spans = []; if (detail.exerciseType!.name == "Warming Up") { quantities = t("Min. 10 minutes"); @@ -423,47 +426,50 @@ class ExerciseTile extends StatelessWidget with Trans { TextSpan(text: quantities), ); } else { - set = detail.set! > 1 ? "${detail.set} " + t("set") : ""; List details = bloc.getAllDetailsSameExercise(detail); int index = 0; bool isWeight = true; - - if (set.length > 0) { - spans.add( - TextSpan( - text: step.toString() + " ", - style: GoogleFonts.archivoBlack( - color: Colors.orange[600], - )), - ); - spans.add( - TextSpan(text: "/ " + set), - ); - } - details.forEach((element) { quantities = ""; - String delimiter = ","; - if (index == 0) { - delimiter = ""; + + if (index > 0) { + spans.add( + TextSpan(text: ", "), + ); } + //print("STEP $step highlight: $highlightStep index: $index"); + if (element.set! > 1) { + spans.add( + TextSpan( + text: (element.exercises.length + 1).toString(), + style: GoogleFonts.archivoBlack( + color: highlightStep == index && noFilter ? Colors.orange[600] : Colors.white, + )), + ); + spans.add( + TextSpan(text: "/${element.set} x "), + ); + } + if (element.repeats == -1) { - quantities += delimiter + " MAX "; + quantities += " MAX "; } else { - quantities += delimiter + " ${element.repeats}"; + quantities += "${element.repeats}"; } - if (element.exerciseType!.unitQuantityUnit != null) { + + if (element.exerciseType!.unitQuantityUnit != null && element.weight != null) { quantities += "x"; if (element.weight == -1 || element.weight == -2 || element.weight == -3) { quantities += "? kg"; } else { num weight = element.weight! % element.weight!.round() == 0 ? element.weight!.round() : element.weight!; + quantities += "$weight kg"; } } else { isWeight = false; } - if (step == index && noFilter) { + if (highlightStep == index && noFilter) { spans.add( TextSpan( text: quantities, @@ -509,15 +515,55 @@ class ExerciseTile extends StatelessWidget with Trans { @override Widget build(BuildContext context) { setContext(context); + //bloc.setTileKey(tileKey); + return CarouselSlider( + options: CarouselOptions( + viewportFraction: 1, + reverse: false, + enableInfiniteScroll: false, + autoPlay: false, + aspectRatio: 1.3, + enlargeCenterPage: true, + onPageChanged: (index, reason) => {print("index changed $index")}, + enlargeStrategy: CenterPageEnlargeStrategy.scale), + items: getExerciseTiles(detail), + ); + } + List getExerciseTiles(CustomerTrainingPlanDetails detail) { + final List list = []; + list.add(getTile(detail)); + + /* if (detail.alternatives.length == 0) { + detail.alternatives = Common.getExerciseTypeAlternatives(detail.exerciseTypeId); + } + if (detail.alternatives.length > 0) { + detail.alternatives.forEach((element) { + CustomerTrainingPlanDetails? alternative = bloc.createDetailFromExerciseType(element, detail); + if (alternative != null) { + final Widget widget = getTile(alternative); + print("Alternatives for ${detail.exerciseTypeId}: $alternative"); + list.add(widget); + } + }); + } */ + + return list; + } + + Widget getTile(CustomerTrainingPlanDetails detail) { final CustomerTrainingPlanDetails? next = bloc.getNext(); final bool noFilter = next != null && next.exerciseTypeId == detail.exerciseTypeId; - final bool done = bloc.isAllDetailsSameExerciseFinished(detail); //detail.state == ExercisePlanDetailState.finished; - final int step = bloc.getStep(detail); //detail.exercises.length; + final bool done = bloc.isAllDetailsSameExerciseFinished(detail); final bool buddyWarning = detail.exerciseType == null ? false : detail.exerciseType!.buddyWarning; - final bool hasAlternative = false; //detail.alternatives.length > 0; + final int step = bloc.getStep(detail); + final int highlightStep = bloc.getHighlightStep(detail); + final bool hasAlternative = detail.alternatives.length > 0; + return Container( - child: Stack(alignment: Alignment.centerRight, children: [ + //key: this.tileKey, + child: ClipRect( + child: Stack(alignment: Alignment.centerRight, children: [ Stack(alignment: Alignment.centerLeft, children: [ Stack(alignment: Alignment.bottomLeft, children: [ Badge( @@ -529,7 +575,7 @@ class ExerciseTile extends StatelessWidget with Trans { badgeColor: Colors.transparent, showBadge: noFilter || done, badgeContent: IconButton( - iconSize: 40, + iconSize: 36, onPressed: () => !done ? skip() : {}, icon: Icon( done ? CustomIcon.ok_circled : Icons.cancel, @@ -559,13 +605,13 @@ class ExerciseTile extends StatelessWidget with Trans { child: Badge( elevation: 0, padding: EdgeInsets.all(0), - position: BadgePosition.topEnd(top: 65, end: 1), + position: BadgePosition.topEnd(top: 5, end: 60), animationDuration: Duration(milliseconds: 500), animationType: BadgeAnimationType.fade, badgeColor: Colors.transparent, showBadge: buddyWarning, badgeContent: IconButton( - iconSize: 50, + iconSize: 36, onPressed: () => showDialog( context: context, builder: (BuildContext context) { @@ -608,7 +654,7 @@ class ExerciseTile extends StatelessWidget with Trans { : null, height: 80, width: double.infinity, - child: getExerciseQuantities(detail, step, noFilter), + child: getExerciseQuantities(detail, step, noFilter, highlightStep), ) ])))), Container( @@ -639,25 +685,31 @@ class ExerciseTile extends StatelessWidget with Trans { ), ]), hasAlternative - ? Image.asset( - 'asset/image/alternatives_arrow.png', - height: 100, - width: 100, - ) + ? Positioned( + top: 50, + child: Image.asset( + 'asset/image/alternatives_arrow.png', + height: 100, + width: 100, + color: noFilter ? Color(0xffb4f500) : Colors.grey, + )) : Offstage(), ]), hasAlternative - ? Transform.rotate( - angle: pi, - alignment: Alignment.center, - child: Image.asset( - 'asset/image/alternatives_arrow.png', - height: 100, - width: 100, - ), + ? Positioned( + top: 50, + child: Transform.rotate( + angle: pi, + alignment: Alignment.center, + child: Image.asset( + 'asset/image/alternatives_arrow.png', + height: 100, + width: 100, + color: noFilter ? Color(0xffb4f500) : Colors.grey, + )), ) : Offstage(), - ])); + ]))); } void skip() { diff --git a/lib/view/training_plan_exercise.dart b/lib/view/training_plan_exercise.dart index c9ba51b..ef3b512 100644 --- a/lib/view/training_plan_exercise.dart +++ b/lib/view/training_plan_exercise.dart @@ -112,8 +112,8 @@ class TrainingPlanExercise extends StatelessWidget with Trans { set: detail.set, exerciseNr: detail.exercises.length + 1, onUnitQuantityChanged: (value) => bloc.add(TrainingPlanWeightChangeRecalculate(weight: value, detail: detail)), - onUnitQuantityChangeUp: () => bloc.add(TrainingPlanWeightChangeUp(detail: detail)), - onUnitQuantityChangeDown: () => bloc.add(TrainingPlanWeightChangeDown(detail: detail)), + //onUnitQuantityChangeUp: () => bloc.add(TrainingPlanWeightChangeUp(detail: detail)), + //onUnitQuantityChangeDown: () => bloc.add(TrainingPlanWeightChangeDown(detail: detail)), onQuantityChanged: (value) => bloc.add(TrainingPlanRepeatsChange(repeats: value.toInt(), detail: detail)), exerciseTypeId: detail.exerciseType!.exerciseTypeId, originalQuantity: originalQuantity, diff --git a/lib/view/training_plans_page.dart b/lib/view/training_plans_page.dart index 0994541..8c7a729 100644 --- a/lib/view/training_plans_page.dart +++ b/lib/view/training_plans_page.dart @@ -10,7 +10,6 @@ import 'package:aitrainer_app/widgets/app_bar.dart'; import 'package:aitrainer_app/widgets/bottom_nav.dart'; import 'package:aitrainer_app/widgets/dialog_common.dart'; import 'package:aitrainer_app/widgets/image_button.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:google_fonts/google_fonts.dart'; diff --git a/lib/widgets/app_bar.dart b/lib/widgets/app_bar.dart index d5073e3..dc89d29 100644 --- a/lib/widgets/app_bar.dart +++ b/lib/widgets/app_bar.dart @@ -6,7 +6,6 @@ import 'package:aitrainer_app/util/app_localization.dart'; import 'package:aitrainer_app/model/cache.dart'; import 'package:aitrainer_app/repository/exercise_repository.dart'; import 'package:aitrainer_app/util/common.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:google_fonts/google_fonts.dart'; diff --git a/lib/widgets/app_bar_min.dart b/lib/widgets/app_bar_min.dart index 6fde260..7754a01 100644 --- a/lib/widgets/app_bar_min.dart +++ b/lib/widgets/app_bar_min.dart @@ -1,7 +1,6 @@ import 'package:aitrainer_app/bloc/timer/timer_bloc.dart'; import 'package:aitrainer_app/model/cache.dart'; import 'package:aitrainer_app/util/common.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:google_fonts/google_fonts.dart'; diff --git a/lib/widgets/app_bar_progress.dart b/lib/widgets/app_bar_progress.dart index 03a0d41..1097233 100644 --- a/lib/widgets/app_bar_progress.dart +++ b/lib/widgets/app_bar_progress.dart @@ -1,6 +1,5 @@ import 'package:aitrainer_app/bloc/timer/timer_bloc.dart'; import 'package:aitrainer_app/util/common.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:aitrainer_app/library/liquid_progress_indicator/liquid_linear_progress_indicator.dart'; diff --git a/lib/widgets/bmi_widget.dart b/lib/widgets/bmi_widget.dart index 644ea5a..16c72b9 100644 --- a/lib/widgets/bmi_widget.dart +++ b/lib/widgets/bmi_widget.dart @@ -1,9 +1,7 @@ import 'package:aitrainer_app/bloc/exercise_new/exercise_new_bloc.dart'; import 'package:aitrainer_app/util/app_localization.dart'; import 'package:aitrainer_app/util/trans.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/widgets.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:syncfusion_flutter_gauges/gauges.dart'; import 'app_bar.dart'; diff --git a/lib/widgets/bmr_widget.dart b/lib/widgets/bmr_widget.dart index aca4e21..4e6d666 100644 --- a/lib/widgets/bmr_widget.dart +++ b/lib/widgets/bmr_widget.dart @@ -3,9 +3,7 @@ import 'package:aitrainer_app/util/app_localization.dart'; import 'package:aitrainer_app/model/fitness_state.dart'; import 'package:aitrainer_app/util/trans.dart'; import 'package:aitrainer_app/library/dropdown_search/dropdown_search.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/widgets.dart'; import 'package:google_fonts/google_fonts.dart'; import 'app_bar.dart'; import 'package:keyboard_actions/keyboard_actions.dart'; diff --git a/lib/widgets/bottom_nav.dart b/lib/widgets/bottom_nav.dart index f6612d6..07d7458 100644 --- a/lib/widgets/bottom_nav.dart +++ b/lib/widgets/bottom_nav.dart @@ -1,5 +1,3 @@ -import 'dart:ui'; - import 'package:aitrainer_app/model/cache.dart'; import 'package:aitrainer_app/service/logging.dart'; import 'package:aitrainer_app/util/common.dart'; diff --git a/lib/widgets/dialog_html.dart b/lib/widgets/dialog_html.dart index eb107a7..c9fa88f 100644 --- a/lib/widgets/dialog_html.dart +++ b/lib/widgets/dialog_html.dart @@ -1,7 +1,6 @@ import 'package:aitrainer_app/util/trans.dart'; import 'package:flutter/material.dart'; import 'package:flutter_html/flutter_html.dart'; -import 'package:flutter_html/style.dart'; import 'package:google_fonts/google_fonts.dart'; // ignore: must_be_immutable diff --git a/lib/widgets/exercise_save.dart b/lib/widgets/exercise_save.dart index 02d49a0..a9cb648 100644 --- a/lib/widgets/exercise_save.dart +++ b/lib/widgets/exercise_save.dart @@ -11,7 +11,6 @@ import 'package:flutter/material.dart'; import 'package:flutter/scheduler.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:keyboard_actions/keyboard_actions.dart'; -import 'package:keyboard_actions/keyboard_actions_config.dart'; import 'package:stop_watch_timer/stop_watch_timer.dart'; import 'package:wakelock/wakelock.dart'; import 'dialog_html.dart'; diff --git a/lib/widgets/home.dart b/lib/widgets/home.dart index 3a0e4c1..d83c12a 100644 --- a/lib/widgets/home.dart +++ b/lib/widgets/home.dart @@ -9,10 +9,8 @@ import 'package:aitrainer_app/view/login.dart'; import 'package:aitrainer_app/view/menu_page.dart'; import 'package:aitrainer_app/widgets/dialog_common.dart'; import 'package:firebase_messaging/firebase_messaging.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/scheduler.dart'; -import 'package:flutter/widgets.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:upgrader/upgrader.dart'; import 'loading.dart'; diff --git a/lib/widgets/image_button.dart b/lib/widgets/image_button.dart index c935bf2..34e390a 100644 --- a/lib/widgets/image_button.dart +++ b/lib/widgets/image_button.dart @@ -1,7 +1,6 @@ import 'dart:ui'; import 'package:aitrainer_app/model/cache.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:bloc/bloc.dart'; import 'package:google_fonts/google_fonts.dart'; diff --git a/lib/widgets/loading.dart b/lib/widgets/loading.dart index 6f47e22..b19561e 100644 --- a/lib/widgets/loading.dart +++ b/lib/widgets/loading.dart @@ -1,5 +1,4 @@ import 'package:aitrainer_app/widgets/app_bar_min.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; class LoadingScreenMain extends StatelessWidget { diff --git a/lib/widgets/menu_image.dart b/lib/widgets/menu_image.dart index da4d1bd..7ebaa04 100644 --- a/lib/widgets/menu_image.dart +++ b/lib/widgets/menu_image.dart @@ -3,7 +3,6 @@ import 'dart:convert'; import 'package:flutter/material.dart'; import 'package:aitrainer_app/library/image_cache.dart' as wt; import 'package:aitrainer_app/library/transparent_image.dart'; -import 'package:flutter_html/shims/dart_ui_real.dart'; // ignore: must_be_immutable class MenuImage extends StatelessWidget { diff --git a/lib/widgets/menu_page_widget.dart b/lib/widgets/menu_page_widget.dart index 93d5df3..0b9481f 100644 --- a/lib/widgets/menu_page_widget.dart +++ b/lib/widgets/menu_page_widget.dart @@ -1,5 +1,4 @@ import 'dart:collection'; -import 'dart:ui'; import 'package:aitrainer_app/bloc/training_plan/training_plan_bloc.dart'; import 'package:aitrainer_app/model/exercise_ability.dart'; import 'package:aitrainer_app/bloc/menu/menu_bloc.dart'; @@ -19,9 +18,7 @@ import 'package:aitrainer_app/widgets/dialog_common.dart'; import 'package:badges/badges.dart'; import 'package:ezanimation/ezanimation.dart'; import 'package:firebase_dynamic_links/firebase_dynamic_links.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/painting.dart'; import 'package:flutter/scheduler.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:google_fonts/google_fonts.dart'; @@ -108,15 +105,12 @@ class _MenuPageWidgetState extends State with Trans, Logging { } Future initDynamicLinks() async { - FirebaseDynamicLinks.instance.onLink(onSuccess: (PendingDynamicLinkData? dynamicLink) async { - final Uri? deepLink = dynamicLink?.link; + FirebaseDynamicLinks.instance.onLink.listen((dynamicLink) { + final Uri deepLink = dynamicLink.link; print("DeepLink: $deepLink"); - if (deepLink != null) { - // ignore: unawaited_futures - final String deepLinkPath = deepLink.path.replaceFirst("/", ""); - Navigator.pushNamed(context, deepLinkPath); - } - }, onError: (OnLinkErrorException e) async { + final String deepLinkPath = deepLink.path.replaceFirst("/", ""); + Navigator.pushNamed(context, deepLinkPath); + }, onError: (e) async { print('onLinkError'); print(e.message); }); diff --git a/lib/widgets/size_widget.dart b/lib/widgets/size_widget.dart index a4d058e..2943055 100644 --- a/lib/widgets/size_widget.dart +++ b/lib/widgets/size_widget.dart @@ -2,9 +2,7 @@ import 'package:aitrainer_app/bloc/exercise_new/exercise_new_bloc.dart'; import 'package:aitrainer_app/library/custom_icon_icons.dart'; import 'package:aitrainer_app/model/property.dart'; import 'package:aitrainer_app/util/trans.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/widgets.dart'; import 'package:google_fonts/google_fonts.dart'; import 'app_bar.dart'; import 'input_dialog_widget.dart'; diff --git a/lib/widgets/treeview_parent_widget.dart b/lib/widgets/treeview_parent_widget.dart index 60c107a..085e02f 100644 --- a/lib/widgets/treeview_parent_widget.dart +++ b/lib/widgets/treeview_parent_widget.dart @@ -1,4 +1,3 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; diff --git a/lib/widgets/tutorial_widget.dart b/lib/widgets/tutorial_widget.dart index 4318820..7fa08ec 100644 --- a/lib/widgets/tutorial_widget.dart +++ b/lib/widgets/tutorial_widget.dart @@ -7,7 +7,6 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_html/flutter_html.dart'; -import 'package:flutter_html/style.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:aitrainer_app/library/super_tooltip.dart'; @@ -41,8 +40,11 @@ class TutorialWidget with Trans, Logging { } void explanation(BuildContext context, Widget widget) { + final height = MediaQuery.of(context).size.height; + print("Height $height"); + tooltip = SuperTooltip( - top: 120, + top: height < 800 ? 60 : 120, left: 20, right: 20, backgroundColor: Colors.black87, diff --git a/pubspec.lock b/pubspec.lock index e328493..f0c69bb 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -42,7 +42,7 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.8.1" + version: "2.8.2" badges: dependency: "direct main" description: @@ -140,7 +140,7 @@ packages: name: characters url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.2.0" charcode: dependency: transitive description: @@ -161,7 +161,7 @@ packages: name: chewie url: "https://pub.dartlang.org" source: hosted - version: "1.0.0" + version: "1.1.0" chewie_audio: dependency: transitive description: @@ -330,125 +330,139 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "6.1.0" - firebase: - dependency: transitive - description: - name: firebase - url: "https://pub.dartlang.org" - source: hosted - version: "9.0.1" firebase_analytics: dependency: "direct main" description: name: firebase_analytics url: "https://pub.dartlang.org" source: hosted - version: "8.3.3" + version: "9.0.3" firebase_analytics_platform_interface: dependency: transitive description: name: firebase_analytics_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "2.0.1" + version: "3.0.2" firebase_analytics_web: dependency: transitive description: name: firebase_analytics_web url: "https://pub.dartlang.org" source: hosted - version: "0.3.0+1" + version: "0.4.0+3" firebase_auth: dependency: "direct main" description: name: firebase_auth url: "https://pub.dartlang.org" source: hosted - version: "3.1.2" + version: "3.3.3" firebase_auth_platform_interface: dependency: transitive description: name: firebase_auth_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "6.1.1" + version: "6.1.8" firebase_auth_web: dependency: transitive description: name: firebase_auth_web url: "https://pub.dartlang.org" source: hosted - version: "3.1.1" + version: "3.3.4" firebase_core: dependency: "direct main" description: name: firebase_core url: "https://pub.dartlang.org" source: hosted - version: "1.10.0" + version: "1.10.5" firebase_core_platform_interface: dependency: transitive description: name: firebase_core_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "4.1.0" + version: "4.2.2" firebase_core_web: dependency: transitive description: name: firebase_core_web url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "1.5.2" firebase_dynamic_links: dependency: "direct main" description: name: firebase_dynamic_links url: "https://pub.dartlang.org" source: hosted - version: "2.0.10" + version: "4.0.2" + firebase_dynamic_links_platform_interface: + dependency: transitive + description: + name: firebase_dynamic_links_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "0.2.0+2" firebase_in_app_messaging: dependency: "direct main" description: name: firebase_in_app_messaging url: "https://pub.dartlang.org" source: hosted - version: "0.5.0+13" + version: "0.6.0+4" + firebase_in_app_messaging_platform_interface: + dependency: transitive + description: + name: firebase_in_app_messaging_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "0.2.0+4" firebase_messaging: dependency: "direct main" description: name: firebase_messaging url: "https://pub.dartlang.org" source: hosted - version: "10.0.8" + version: "11.2.3" firebase_messaging_platform_interface: dependency: transitive description: name: firebase_messaging_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "3.0.6" + version: "3.1.3" firebase_messaging_web: dependency: transitive description: name: firebase_messaging_web url: "https://pub.dartlang.org" source: hosted - version: "2.0.6" + version: "2.2.4" firebase_remote_config: dependency: "direct main" description: name: firebase_remote_config url: "https://pub.dartlang.org" source: hosted - version: "0.10.0+5" + version: "1.0.2" firebase_remote_config_platform_interface: dependency: transitive description: name: firebase_remote_config_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "0.3.0+6" + version: "1.0.2" + firebase_remote_config_web: + dependency: transitive + description: + name: firebase_remote_config_web + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.2" fixnum: dependency: transitive description: @@ -488,14 +502,14 @@ packages: name: flutter_facebook_auth url: "https://pub.dartlang.org" source: hosted - version: "3.5.2" + version: "3.5.7" flutter_facebook_auth_platform_interface: dependency: transitive description: name: flutter_facebook_auth_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "2.7.0" + version: "2.7.1" flutter_facebook_auth_web: dependency: transitive description: @@ -549,7 +563,49 @@ packages: name: flutter_secure_storage url: "https://pub.dartlang.org" source: hosted - version: "4.2.1" + version: "5.0.2" + flutter_secure_storage_linux: + dependency: transitive + description: + name: flutter_secure_storage_linux + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.0" + flutter_secure_storage_macos: + dependency: transitive + description: + name: flutter_secure_storage_macos + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.0" + flutter_secure_storage_platform_interface: + dependency: transitive + description: + name: flutter_secure_storage_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.0" + flutter_secure_storage_web: + dependency: transitive + description: + name: flutter_secure_storage_web + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.2" + flutter_secure_storage_windows: + dependency: transitive + description: + name: flutter_secure_storage_windows + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.2" + flutter_smartlook: + dependency: "direct main" + description: + name: flutter_smartlook + url: "https://pub.dartlang.org" + source: hosted + version: "3.0.4" flutter_svg: dependency: transitive description: @@ -601,14 +657,14 @@ packages: name: google_sign_in url: "https://pub.dartlang.org" source: hosted - version: "5.1.0" + version: "5.2.1" google_sign_in_platform_interface: dependency: transitive description: name: google_sign_in_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "2.0.1" + version: "2.1.0" google_sign_in_web: dependency: transitive description: @@ -727,7 +783,7 @@ packages: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.10" + version: "0.12.11" meta: dependency: transitive description: @@ -797,42 +853,42 @@ packages: name: package_info_plus url: "https://pub.dartlang.org" source: hosted - version: "1.0.0" + version: "1.3.0" package_info_plus_linux: dependency: transitive description: name: package_info_plus_linux url: "https://pub.dartlang.org" source: hosted - version: "1.0.0" + version: "1.0.3" package_info_plus_macos: dependency: transitive description: name: package_info_plus_macos url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.3.0" package_info_plus_platform_interface: dependency: transitive description: name: package_info_plus_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "1.0.0" + version: "1.0.2" package_info_plus_web: dependency: transitive description: name: package_info_plus_web url: "https://pub.dartlang.org" source: hosted - version: "1.0.0" + version: "1.0.4" package_info_plus_windows: dependency: transitive description: name: package_info_plus_windows url: "https://pub.dartlang.org" source: hosted - version: "1.0.0" + version: "1.0.4" path: dependency: transitive description: @@ -923,7 +979,7 @@ packages: name: plugin_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "2.0.2" pool: dependency: transitive description: @@ -972,7 +1028,7 @@ packages: name: purchases_flutter url: "https://pub.dartlang.org" source: hosted - version: "3.2.2" + version: "3.8.0" quiver: dependency: transitive description: @@ -1007,7 +1063,7 @@ packages: name: rxdart url: "https://pub.dartlang.org" source: hosted - version: "0.27.0" + version: "0.27.3" sentry: dependency: transitive description: @@ -1105,19 +1161,26 @@ packages: name: sign_in_with_apple url: "https://pub.dartlang.org" source: hosted - version: "3.2.0" + version: "3.3.0" + sign_in_with_apple_platform_interface: + dependency: transitive + description: + name: sign_in_with_apple_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.0" + sign_in_with_apple_web: + dependency: transitive + description: + name: sign_in_with_apple_web + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.1" sky_engine: dependency: transitive description: flutter source: sdk version: "0.0.99" - smartlook: - dependency: "direct main" - description: - name: smartlook - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.1" source_gen: dependency: transitive description: @@ -1180,7 +1243,7 @@ packages: name: stop_watch_timer url: "https://pub.dartlang.org" source: hosted - version: "1.2.0+1" + version: "1.3.1" stream_channel: dependency: transitive description: @@ -1271,21 +1334,21 @@ packages: name: test url: "https://pub.dartlang.org" source: hosted - version: "1.17.10" + version: "1.17.12" test_api: dependency: transitive description: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.4.2" + version: "0.4.3" test_core: dependency: transitive description: name: test_core url: "https://pub.dartlang.org" source: hosted - version: "0.4.0" + version: "0.4.2" timeline_tile: dependency: "direct main" description: @@ -1348,7 +1411,7 @@ packages: name: upgrader url: "https://pub.dartlang.org" source: hosted - version: "3.5.1" + version: "3.11.0" url_launcher: dependency: "direct main" description: @@ -1404,7 +1467,7 @@ packages: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.1.0" + version: "2.1.1" version: dependency: transitive description: @@ -1446,28 +1509,35 @@ packages: name: wakelock url: "https://pub.dartlang.org" source: hosted - version: "0.4.0" + version: "0.5.6" wakelock_macos: dependency: transitive description: name: wakelock_macos url: "https://pub.dartlang.org" source: hosted - version: "0.1.0+3" + version: "0.4.0" wakelock_platform_interface: dependency: transitive description: name: wakelock_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "0.2.1+3" + version: "0.3.0" wakelock_web: dependency: transitive description: name: wakelock_web url: "https://pub.dartlang.org" source: hosted - version: "0.2.0+3" + version: "0.4.0" + wakelock_windows: + dependency: transitive + description: + name: wakelock_windows + url: "https://pub.dartlang.org" + source: hosted + version: "0.2.0" watcher: dependency: transitive description: @@ -1540,4 +1610,4 @@ packages: version: "3.1.0" sdks: dart: ">=2.14.0 <3.0.0" - flutter: ">=2.0.0" + flutter: ">=2.5.0" diff --git a/pubspec.yaml b/pubspec.yaml index 8c69c0d..9ab8096 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -40,13 +40,13 @@ dependencies: keyboard_actions: ^3.4.0 badges: ^2.0.1 #health: ^3.0.0 - stop_watch_timer: ^1.2.0+1 + stop_watch_timer: ^1.3.1 #location: ^3.2.4 modal_progress_hud_nsn: ^0.1.0-nullsafety-1 flutter_html: ^2.0.0 - wakelock: ^ 0.4.0 + wakelock: ^ 0.5.6 timeline_tile: ^2.0.0 - purchases_flutter: ^3.2.2 + purchases_flutter: ^3.8.0 package_info: ^2.0.0 ezanimation: ^0.5.0 confetti: ^0.6.0-nullsafety @@ -55,19 +55,19 @@ dependencies: convex_bottom_bar: ^3.0.0 flutter_app_badger: ^1.2.0 extended_tabs: ^2.2.0 - upgrader: ^3.5.1 + upgrader: ^3.11.0 web_browser: ^0.5.0 flutter_fadein: ^2.0.0 mailto: ^2.0.0 url_launcher: ^6.0.9 - firebase_core: ^1.5.0 - firebase_analytics: ^8.1.0 - firebase_messaging: ^10.0.0 - firebase_auth: ^3.0.2 - firebase_remote_config: ^0.10.0+4 - firebase_dynamic_links: ^2.0.8 - firebase_in_app_messaging: ^0.5.0+13 + firebase_core: ^1.10.5 + firebase_analytics: ^9.0.3 + firebase_messaging: ^11.2.3 + firebase_auth: ^3.3.3 + firebase_remote_config: ^1.0.2 + firebase_dynamic_links: ^4.0.2 + firebase_in_app_messaging: ^0.6.0+4 syncfusion_flutter_gauges: ^19.3.48 syncfusion_flutter_datagrid: ^19.1.63 @@ -75,11 +75,11 @@ dependencies: syncfusion_flutter_calendar: ^19.3.53 syncfusion_localizations: ^19.3.54 - flutter_facebook_auth: ^3.5.1 - google_sign_in: ^5.0.3 - sign_in_with_apple: ^3.0.0 + flutter_facebook_auth: ^3.5.7 + google_sign_in: ^5.2.1 + sign_in_with_apple: ^3.3.0 - smartlook: ^2.0.1 + flutter_smartlook: ^3.0.4 #flurry_data: ^0.0.1 flutter_uxcam: ^2.0.1 @@ -87,7 +87,7 @@ dependencies: mockito: ^5.0.3 sqflite: ^2.0.0+3 - flutter_secure_storage: ^4.2.0 + flutter_secure_storage: ^5.0.2 #social_share: ^2.1.1 flutter_localizations: diff --git a/test/widget_test.db.dart b/test/widget_test.db.dart index b1f5d8f..d9c2e2c 100644 --- a/test/widget_test.db.dart +++ b/test/widget_test.db.dart @@ -6,7 +6,7 @@ // tree, read text, and verify that the values of widget properties are correct. //import 'package:aitrainer_app/bloc/login_form_bloc.dart'; -import 'package:aitrainer_app/helper/database.dart'; +/* import 'package:aitrainer_app/library_keys.dart'; import 'package:aitrainer_app/util/app_localization.dart'; import 'package:aitrainer_app/model/user.dart'; @@ -16,9 +16,10 @@ import 'package:aitrainer_app/view/login.dart'; import 'package:bloc_test/bloc_test.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:flutter_localizations/flutter_localizations.dart'; */ +import 'package:aitrainer_app/helper/database.dart'; import 'package:flutter_test/flutter_test.dart'; -import 'package:mockito/mockito.dart'; +//import 'package:mockito/mockito.dart'; void main() { group('SQFLite', () { diff --git a/test/widget_test.login.dart b/test/widget_test.login.dart index 8b30ee4..3689722 100644 --- a/test/widget_test.login.dart +++ b/test/widget_test.login.dart @@ -6,7 +6,6 @@ // tree, read text, and verify that the values of widget properties are correct. //import 'package:aitrainer_app/bloc/login_form_bloc.dart'; -import 'package:aitrainer_app/bloc/login/login_bloc.dart'; import 'package:aitrainer_app/helper/database.dart'; import 'package:aitrainer_app/library_keys.dart'; import 'package:aitrainer_app/util/app_localization.dart'; @@ -14,7 +13,7 @@ import 'package:aitrainer_app/model/user.dart'; import 'package:aitrainer_app/repository/user_repository.dart'; import 'package:aitrainer_app/util/common.dart'; import 'package:aitrainer_app/view/login.dart'; -import 'package:bloc_test/bloc_test.dart'; + import 'package:flutter/material.dart'; import 'package:flutter_localizations/flutter_localizations.dart'; diff --git a/test_driver/app.dart b/test_driver/app.dart index a053e8b..dfb04f1 100644 --- a/test_driver/app.dart +++ b/test_driver/app.dart @@ -1,5 +1,5 @@ //import 'package:flutter_driver/driver_extension.dart'; -import 'package:aitrainer_app/main.dart' as app; +//import 'package:aitrainer_app/main.dart' as app; /* void main() { // This line enables the extension. diff --git a/test_driver/app_test.dart b/test_driver/app_test.dart index b2525b5..7ca0ea7 100644 --- a/test_driver/app_test.dart +++ b/test_driver/app_test.dart @@ -1,8 +1,8 @@ // Imports the Flutter Driver API. //import 'package:flutter_driver/flutter_driver.dart'; -import 'package:test/test.dart'; +//import 'package:test/test.dart'; -import '../lib/helper/database.dart'; +//import '../lib/helper/database.dart'; /* void main() { FlutterDriver driver; diff --git a/test_driver/service/customer_service.dart b/test_driver/service/customer_service.dart index d16e1c2..b454397 100644 --- a/test_driver/service/customer_service.dart +++ b/test_driver/service/customer_service.dart @@ -1,5 +1,4 @@ import 'package:aitrainer_app/model/customer.dart'; -import 'package:flutter/material.dart'; import '../../lib/helper/database.dart'; class CustomerApi {