From f16e8ec444307506f0b7af5f7f1b6304b8b6fe3e Mon Sep 17 00:00:00 2001 From: Github-actions Date: Sat, 16 Oct 2021 10:44:22 +0000 Subject: [PATCH 01/40] Automatic linting --- pubspec.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pubspec.lock b/pubspec.lock index 9bd5bcf0..650889ca 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -14,7 +14,7 @@ packages: name: analyzer url: "https://pub.dartlang.org" source: hosted - version: "1.7.1" + version: "1.7.2" android_metadata: dependency: "direct main" description: @@ -42,7 +42,7 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.6.1" + version: "2.8.1" boolean_selector: dependency: transitive description: @@ -133,7 +133,7 @@ packages: name: charcode url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "1.3.1" charts_common: dependency: transitive description: @@ -524,7 +524,7 @@ packages: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.3.0" + version: "1.7.0" mime: dependency: transitive description: @@ -823,7 +823,7 @@ packages: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.3.0" + version: "0.4.2" timing: dependency: transitive description: From 68228554e0668854d1c84825843d86dcd011de18 Mon Sep 17 00:00:00 2001 From: ToldYouThat Date: Sun, 17 Oct 2021 15:23:04 +0000 Subject: [PATCH 02/40] Translated using Weblate (Turkish) Currently translated at 29.5% (44 of 149 strings) Translation: wger Workout Manager/Mobile App Translate-URL: https://hosted.weblate.org/projects/wger/mobile/tr/ --- lib/l10n/app_tr.arb | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/l10n/app_tr.arb b/lib/l10n/app_tr.arb index 7edc9c26..630e4769 100644 --- a/lib/l10n/app_tr.arb +++ b/lib/l10n/app_tr.arb @@ -154,5 +154,15 @@ "description": "Label used in RiR slider when the RiR value is not used/saved for the current setting or log" }, "weightUnit": "Ağırlık birimi", - "@weightUnit": {} + "@weightUnit": {}, + "dayDescriptionHelp": "O gün yapılanların (örn. 'çekme günü') veya hangi vücut bölümlerinin (örn. 'göğüs ve omuzlar') çalıştırıldığının açıklaması", + "@dayDescriptionHelp": {}, + "setNr": "{nr} ayarla", + "@setNr": { + "description": "Header in form indicating the number of the current set. Can also be translated as something like 'Set Nr. xy'.", + "type": "text", + "placeholders": { + "nr": {} + } + } } From 4fd364236bf62889d20c912fce4f0ee57ad74b97 Mon Sep 17 00:00:00 2001 From: "J. Lavoie" Date: Thu, 21 Oct 2021 01:40:36 +0000 Subject: [PATCH 03/40] Translated using Weblate (German) Currently translated at 97.9% (146 of 149 strings) Translation: wger Workout Manager/Mobile App Translate-URL: https://hosted.weblate.org/projects/wger/mobile/de/ --- lib/l10n/app_de.arb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/l10n/app_de.arb b/lib/l10n/app_de.arb index f200d9fa..62140c90 100644 --- a/lib/l10n/app_de.arb +++ b/lib/l10n/app_de.arb @@ -509,5 +509,11 @@ "proteinShort": "P", "@proteinShort": { "description": "The first letter or short name of the word 'Protein', used in overviews" - } + }, + "measurement": "Messung", + "@measurement": {}, + "appUpdateContent": "Diese Version der Anwendung ist nicht mit dem Server kompatibel, bitte aktualisieren Sie Ihre Anwendung.", + "@appUpdateContent": {}, + "appUpdateTitle": "Aktualisierung erforderlich", + "@appUpdateTitle": {} } From f8f21a1a039baca1aba38fdf08b2e1a4d39a2189 Mon Sep 17 00:00:00 2001 From: "J. Lavoie" Date: Thu, 21 Oct 2021 01:42:44 +0000 Subject: [PATCH 04/40] Translated using Weblate (Italian) Currently translated at 91.9% (137 of 149 strings) Translation: wger Workout Manager/Mobile App Translate-URL: https://hosted.weblate.org/projects/wger/mobile/it/ --- lib/l10n/app_it.arb | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/lib/l10n/app_it.arb b/lib/l10n/app_it.arb index 409110c1..68f4d7b5 100644 --- a/lib/l10n/app_it.arb +++ b/lib/l10n/app_it.arb @@ -448,5 +448,41 @@ "usernameValidChars": "Un nome utente può contenere solo lettere, cifre e i caratteri @, +, ., - e _", "@usernameValidChars": { "description": "Error message when the user tries to register a username with forbidden characters" + }, + "total": "Totale", + "@total": { + "description": "Label used for total sums of e.g. calories or similar" + }, + "appUpdateTitle": "Aggiornamento necessario", + "@appUpdateTitle": {}, + "appUpdateContent": "Questa versione dell'applicazione non è compatibile con il server, per favore aggiorna la tua applicazione.", + "@appUpdateContent": {}, + "dataCopied": "Dati copiati nella nuova voce", + "@dataCopied": { + "description": "Snackbar message to show on copying data to a new log entry" + }, + "proteinShort": "P", + "@proteinShort": { + "description": "The first letter or short name of the word 'Protein', used in overviews" + }, + "carbohydratesShort": "C", + "@carbohydratesShort": { + "description": "The first letter or short name of the word 'Carbohydrates', used in overviews" + }, + "percentEnergy": "Percentuale di energia", + "@percentEnergy": {}, + "fatShort": "Gr", + "@fatShort": { + "description": "The first letter or short name of the word 'Fat', used in overviews" + }, + "logged": "Registrato", + "@logged": { + "description": "Header for the column of 'logged' nutritional values, i.e. what was eaten" + }, + "difference": "Differenza", + "@difference": {}, + "gPerBodyKg": "g per kg di corpo", + "@gPerBodyKg": { + "description": "Label used for total sums of e.g. calories or similar in grams per Kg of body weight" } } From dc55bcd682066128024ed70366a28b94b773874f Mon Sep 17 00:00:00 2001 From: "J. Lavoie" Date: Thu, 21 Oct 2021 01:40:10 +0000 Subject: [PATCH 05/40] Translated using Weblate (French) Currently translated at 100.0% (149 of 149 strings) Translation: wger Workout Manager/Mobile App Translate-URL: https://hosted.weblate.org/projects/wger/mobile/fr/ --- lib/l10n/app_fr.arb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/l10n/app_fr.arb b/lib/l10n/app_fr.arb index 795bcfe2..6681fd18 100644 --- a/lib/l10n/app_fr.arb +++ b/lib/l10n/app_fr.arb @@ -518,5 +518,9 @@ "proteinShort": "P", "@proteinShort": { "description": "The first letter or short name of the word 'Protein', used in overviews" - } + }, + "appUpdateTitle": "Mise à jour nécessaire", + "@appUpdateTitle": {}, + "appUpdateContent": "Cette version de l'application n'est pas compatible avec le serveur, veuillez mettre à jour votre application.", + "@appUpdateContent": {} } From e82ac733b9143ead5dd095f2abe95760a430b298 Mon Sep 17 00:00:00 2001 From: "J. Lavoie" Date: Thu, 21 Oct 2021 01:46:53 +0000 Subject: [PATCH 06/40] Translated using Weblate (German) Currently translated at 97.9% (146 of 149 strings) Translation: wger Workout Manager/Mobile App Translate-URL: https://hosted.weblate.org/projects/wger/mobile/de/ --- lib/l10n/app_de.arb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/l10n/app_de.arb b/lib/l10n/app_de.arb index 62140c90..f5f634c6 100644 --- a/lib/l10n/app_de.arb +++ b/lib/l10n/app_de.arb @@ -297,7 +297,7 @@ }, "selectExercises": "Wenn du einen Supersatz machen willst, kannst du nach mehreren Übungen suchen, sie werden dann gruppiert", "@selectExercises": {}, - "sameRepetitions": "Wenn du für alle Sätze die gleichen Wiederholungen und das gleiche Gewicht verwendest, kannst du nur eine Zeile ausfüllen. Gebe z. B. für 4 Sätze einfach 10 für die Wiederholungen ein, daraus wird automatisch \"4 x 10\".", + "sameRepetitions": "Wenn du für alle Sätze die gleichen Wiederholungen und das gleiche Gewicht verwendest, kannst du nur eine Zeile ausfüllen. Gebe z. B. für 4 Sätze einfach 10 für die Wiederholungen ein, daraus wird automatisch „4 × 10„.", "@sameRepetitions": {}, "setNr": "Satz {nr}", "@setNr": { @@ -307,7 +307,7 @@ "nr": {} } }, - "dayDescriptionHelp": "Eine Beschreibung was an diesem Tag gemacht wird (z. B. \"Zugtag\") oder welche Körperteile trainiert werden (z. B. \"Brust und Schultern\")", + "dayDescriptionHelp": "Eine Beschreibung was an diesem Tag gemacht wird (z. B. „Zugtag“) oder welche Körperteile trainiert werden (z. B. „Brust und Schultern“)", "@dayDescriptionHelp": {}, "set": "Satz", "@set": { @@ -494,9 +494,9 @@ "@value": { "description": "The value of a measurement entry" }, - "measurementCategoriesHelpText": "Messkategorie, z. B. \"Bizeps\" oder \"Körperfett\"", + "measurementCategoriesHelpText": "Messkategorie, z. B. „Bizeps“ oder „Körperfett“", "@measurementCategoriesHelpText": {}, - "measurementEntriesHelpText": "Die Einheit, die verwendet wird, um die Kategorie zu messen, wie z.B. 'cm' oder '%'", + "measurementEntriesHelpText": "Die Einheit, die verwendet wird, um die Kategorie zu messen, wie z.B. „cm“ oder „%“", "@measurementEntriesHelpText": {}, "fatShort": "F", "@fatShort": { From 7eee34df19151ea8ff4899c198a60d32ee020e76 Mon Sep 17 00:00:00 2001 From: "J. Lavoie" Date: Thu, 21 Oct 2021 01:44:03 +0000 Subject: [PATCH 07/40] Translated using Weblate (Italian) Currently translated at 97.9% (146 of 149 strings) Translation: wger Workout Manager/Mobile App Translate-URL: https://hosted.weblate.org/projects/wger/mobile/it/ --- lib/l10n/app_it.arb | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/lib/l10n/app_it.arb b/lib/l10n/app_it.arb index 68f4d7b5..7a0a798c 100644 --- a/lib/l10n/app_it.arb +++ b/lib/l10n/app_it.arb @@ -93,11 +93,11 @@ }, "ingredient": "Ingrediente", "@ingredient": {}, - "timeEnd": "Fine del tempo", + "timeEnd": "Ora di fine", "@timeEnd": { "description": "The end time of a workout" }, - "timeStart": "Inizia cronometro", + "timeStart": "Ora di inizio", "@timeStart": { "description": "The starting time of a workout" }, @@ -484,5 +484,31 @@ "gPerBodyKg": "g per kg di corpo", "@gPerBodyKg": { "description": "Label used for total sums of e.g. calories or similar in grams per Kg of body weight" - } + }, + "timeStartAhead": "L'ora di inizio non può essere più avanti dell'ora di fine", + "@timeStartAhead": {}, + "value": "Valore", + "@value": { + "description": "The value of a measurement entry" + }, + "measurements": "Misure", + "@measurements": { + "description": "Categories for the measurements such as biceps size, body fat, etc." + }, + "measurementCategoriesHelpText": "Categoria di misura, come «bicipiti» o «grasso corporeo»", + "@measurementCategoriesHelpText": {}, + "measurementEntriesHelpText": "L'unità usata per misurare la categoria come «cm» o «%»", + "@measurementEntriesHelpText": {}, + "energyShort": "E", + "@energyShort": { + "description": "The first letter or short name of the word 'Energy', used in overviews" + }, + "macronutrients": "Macronutrienti", + "@macronutrients": {}, + "planned": "Pianificato", + "@planned": { + "description": "Header for the column of 'planned' nutritional values, i.e. what should be eaten" + }, + "measurement": "Misura", + "@measurement": {} } From 3ca1960e6ae22929043ef0b5907c864cedecfbe3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandi=20Milohani=C4=87?= Date: Fri, 22 Oct 2021 08:32:02 +0200 Subject: [PATCH 08/40] add reference from log to meal --- lib/models/nutrition/log.dart | 5 +++++ lib/models/nutrition/log.g.dart | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/models/nutrition/log.dart b/lib/models/nutrition/log.dart index fec9c607..1d1dd90e 100644 --- a/lib/models/nutrition/log.dart +++ b/lib/models/nutrition/log.dart @@ -31,6 +31,9 @@ class Log { @JsonKey(required: true) int? id; + @JsonKey(required: false, name: 'meal') + late int? mealId; + @JsonKey(required: true, name: 'plan') int planId; @@ -56,6 +59,7 @@ class Log { Log({ this.id, + required this.mealId, required this.ingredientId, required this.weightUnitId, required this.amount, @@ -70,6 +74,7 @@ class Log { weightUnitId = mealItem.weightUnitId; datetime = dateTime ?? DateTime.now(); amount = mealItem.amount; + mealId = mealItem.id; } // Boilerplate diff --git a/lib/models/nutrition/log.g.dart b/lib/models/nutrition/log.g.dart index 7e64e384..430e924a 100644 --- a/lib/models/nutrition/log.g.dart +++ b/lib/models/nutrition/log.g.dart @@ -8,13 +8,14 @@ part of 'log.dart'; Log _$LogFromJson(Map json) { $checkKeys(json, - requiredKeys: const ['id', 'plan', 'datetime', 'ingredient', 'weight_unit', 'amount']); + requiredKeys: const ['id', 'meal', 'plan', 'datetime', 'ingredient', 'weight_unit', 'amount']); return Log( id: json['id'] as int?, ingredientId: json['ingredient'] as int, weightUnitId: json['weight_unit'] as int?, amount: stringToNum(json['amount'] as String?), planId: json['plan'] as int, + mealId: json['meal'] as int, datetime: DateTime.parse(json['datetime'] as String), comment: json['comment'] as String?, ); @@ -22,6 +23,7 @@ Log _$LogFromJson(Map json) { Map _$LogToJson(Log instance) => { 'id': instance.id, + 'meal': instance.mealId, 'plan': instance.planId, 'datetime': instance.datetime.toIso8601String(), 'comment': instance.comment, From 364b37c1060634b49a74332666e77f786b124988 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandi=20Milohani=C4=87?= Date: Sat, 23 Oct 2021 07:37:14 +0200 Subject: [PATCH 09/40] Correction reference mealId in log --- lib/models/nutrition/log.dart | 5 ++--- lib/providers/nutrition.dart | 2 +- test_data/nutritional_plans.dart | 6 +++--- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/lib/models/nutrition/log.dart b/lib/models/nutrition/log.dart index 1d1dd90e..97892b53 100644 --- a/lib/models/nutrition/log.dart +++ b/lib/models/nutrition/log.dart @@ -32,7 +32,7 @@ class Log { int? id; @JsonKey(required: false, name: 'meal') - late int? mealId; + int mealId; @JsonKey(required: true, name: 'plan') int planId; @@ -68,13 +68,12 @@ class Log { this.comment, }); - Log.fromMealItem(MealItem mealItem, this.planId, [DateTime? dateTime]) { + Log.fromMealItem(MealItem mealItem, this.planId, this.mealId, [DateTime? dateTime]) { ingredientId = mealItem.ingredientId; ingredientObj = mealItem.ingredientObj; weightUnitId = mealItem.weightUnitId; datetime = dateTime ?? DateTime.now(); amount = mealItem.amount; - mealId = mealItem.id; } // Boilerplate diff --git a/lib/providers/nutrition.dart b/lib/providers/nutrition.dart index d82f5df2..32bc1be3 100644 --- a/lib/providers/nutrition.dart +++ b/lib/providers/nutrition.dart @@ -330,7 +330,7 @@ class NutritionPlansProvider extends WgerBaseProvider with ChangeNotifier { Future logMealToDiary(Meal meal) async { for (final item in meal.mealItems) { final plan = findById(meal.planId); - final Log log = Log.fromMealItem(item, plan.id!); + final Log log = Log.fromMealItem(item, plan.id!, meal.id!); final data = await post(log.toJson(), makeUrl(_nutritionDiaryPath)); log.id = data['id']; diff --git a/test_data/nutritional_plans.dart b/test_data/nutritional_plans.dart index 3983b92b..fae75c85 100644 --- a/test_data/nutritional_plans.dart +++ b/test_data/nutritional_plans.dart @@ -106,9 +106,9 @@ NutritionalPlan getNutritionalPlan() { plan.meals = [meal1, meal2]; // Add logs - plan.logs.add(Log.fromMealItem(mealItem1, 1, DateTime(2021, 6, 1))); - plan.logs.add(Log.fromMealItem(mealItem2, 1, DateTime(2021, 6, 1))); - plan.logs.add(Log.fromMealItem(mealItem3, 1, DateTime(2021, 6, 10))); + plan.logs.add(Log.fromMealItem(mealItem1, 1,1, DateTime(2021, 6, 1))); + plan.logs.add(Log.fromMealItem(mealItem2, 1,1, DateTime(2021, 6, 1))); + plan.logs.add(Log.fromMealItem(mealItem3, 1,1, DateTime(2021, 6, 10))); return plan; } From a2ae840c62b17d1a23f8ad8a1239edd9cdd59002 Mon Sep 17 00:00:00 2001 From: Github-actions Date: Sat, 23 Oct 2021 13:46:41 +0000 Subject: [PATCH 10/40] Automatic linting --- lib/models/nutrition/log.g.dart | 11 +++++++++-- test_data/nutritional_plans.dart | 6 +++--- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/lib/models/nutrition/log.g.dart b/lib/models/nutrition/log.g.dart index 430e924a..ab16389a 100644 --- a/lib/models/nutrition/log.g.dart +++ b/lib/models/nutrition/log.g.dart @@ -7,8 +7,15 @@ part of 'log.dart'; // ************************************************************************** Log _$LogFromJson(Map json) { - $checkKeys(json, - requiredKeys: const ['id', 'meal', 'plan', 'datetime', 'ingredient', 'weight_unit', 'amount']); + $checkKeys(json, requiredKeys: const [ + 'id', + 'meal', + 'plan', + 'datetime', + 'ingredient', + 'weight_unit', + 'amount' + ]); return Log( id: json['id'] as int?, ingredientId: json['ingredient'] as int, diff --git a/test_data/nutritional_plans.dart b/test_data/nutritional_plans.dart index 6be005c8..5e7836c8 100644 --- a/test_data/nutritional_plans.dart +++ b/test_data/nutritional_plans.dart @@ -106,9 +106,9 @@ NutritionalPlan getNutritionalPlan() { plan.meals = [meal1, meal2]; // Add logs - plan.logs.add(Log.fromMealItem(mealItem1, 1,1, DateTime(2021, 6, 1))); - plan.logs.add(Log.fromMealItem(mealItem2, 1,1, DateTime(2021, 6, 1))); - plan.logs.add(Log.fromMealItem(mealItem3, 1,1, DateTime(2021, 6, 10))); + plan.logs.add(Log.fromMealItem(mealItem1, 1, 1, DateTime(2021, 6, 1))); + plan.logs.add(Log.fromMealItem(mealItem2, 1, 1, DateTime(2021, 6, 1))); + plan.logs.add(Log.fromMealItem(mealItem3, 1, 1, DateTime(2021, 6, 10))); return plan; } From e8ca3dd33f17ac784c037defff3d607889a9da48 Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Wed, 6 Oct 2021 20:05:29 +0200 Subject: [PATCH 11/40] Use correct file name --- .github/pull_request_template.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 01f9763a..28eea257 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -12,4 +12,4 @@ Related Issues (if applicable) - [ ] Set a 100 character limit in your editor/IDE to avoid white space diffs in the PR - [ ] Tests for the changes have been added (for bug fixes / features) -- [ ] Added yourself to AUTHORS.rst +- [ ] Added yourself to AUTHORS.md From c5930866925cbeb4e53b068c2baa7c17b0fd65e2 Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Sun, 24 Oct 2021 22:14:00 +0200 Subject: [PATCH 12/40] Mark meal ID in logs as optional --- lib/models/nutrition/log.dart | 2 +- lib/models/nutrition/log.g.dart | 13 +++-------- pubspec.lock | 22 +++++++++---------- test/base_provider_test.mocks.dart | 2 ++ test/gallery_screen_test.mocks.dart | 5 +++++ ...surement_categories_screen_test.mocks.dart | 2 ++ .../measurement_provider_test.mocks.dart | 2 ++ test/nutritional_plan_form_test.mocks.dart | 5 +++++ test/workout_form_test.mocks.dart | 10 +++++++++ test/workout_set_form_test.mocks.dart | 2 ++ 10 files changed, 43 insertions(+), 22 deletions(-) diff --git a/lib/models/nutrition/log.dart b/lib/models/nutrition/log.dart index 97892b53..6b38a662 100644 --- a/lib/models/nutrition/log.dart +++ b/lib/models/nutrition/log.dart @@ -32,7 +32,7 @@ class Log { int? id; @JsonKey(required: false, name: 'meal') - int mealId; + int? mealId; @JsonKey(required: true, name: 'plan') int planId; diff --git a/lib/models/nutrition/log.g.dart b/lib/models/nutrition/log.g.dart index ab16389a..72c3f639 100644 --- a/lib/models/nutrition/log.g.dart +++ b/lib/models/nutrition/log.g.dart @@ -7,22 +7,15 @@ part of 'log.dart'; // ************************************************************************** Log _$LogFromJson(Map json) { - $checkKeys(json, requiredKeys: const [ - 'id', - 'meal', - 'plan', - 'datetime', - 'ingredient', - 'weight_unit', - 'amount' - ]); + $checkKeys(json, + requiredKeys: const ['id', 'plan', 'datetime', 'ingredient', 'weight_unit', 'amount']); return Log( id: json['id'] as int?, + mealId: json['meal'] as int?, ingredientId: json['ingredient'] as int, weightUnitId: json['weight_unit'] as int?, amount: stringToNum(json['amount'] as String?), planId: json['plan'] as int, - mealId: json['meal'] as int, datetime: DateTime.parse(json['datetime'] as String), comment: json['comment'] as String?, ); diff --git a/pubspec.lock b/pubspec.lock index 650889ca..a813d25c 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -14,7 +14,7 @@ packages: name: analyzer url: "https://pub.dartlang.org" source: hosted - version: "1.7.2" + version: "1.7.1" android_metadata: dependency: "direct main" description: @@ -42,7 +42,7 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.8.1" + version: "2.6.1" boolean_selector: dependency: transitive description: @@ -133,7 +133,7 @@ packages: name: charcode url: "https://pub.dartlang.org" source: hosted - version: "1.3.1" + version: "1.2.0" charts_common: dependency: transitive description: @@ -353,7 +353,7 @@ packages: name: flutter_plugin_android_lifecycle url: "https://pub.dartlang.org" source: hosted - version: "2.0.3" + version: "2.0.4" flutter_svg: dependency: transitive description: @@ -384,7 +384,7 @@ packages: name: font_awesome_flutter url: "https://pub.dartlang.org" source: hosted - version: "9.1.0" + version: "9.2.0" frontend_server_client: dependency: transitive description: @@ -454,7 +454,7 @@ packages: name: image_picker_for_web url: "https://pub.dartlang.org" source: hosted - version: "2.1.3" + version: "2.1.4" image_picker_platform_interface: dependency: transitive description: @@ -524,14 +524,14 @@ packages: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.7.0" + version: "1.3.0" mime: dependency: transitive description: name: mime url: "https://pub.dartlang.org" source: hosted - version: "1.0.0" + version: "1.0.1" mockito: dependency: "direct dev" description: @@ -809,7 +809,7 @@ packages: name: table_calendar url: "https://pub.dartlang.org" source: hosted - version: "3.0.2" + version: "3.0.3" term_glyph: dependency: transitive description: @@ -823,7 +823,7 @@ packages: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.4.2" + version: "0.3.0" timing: dependency: transitive description: @@ -984,7 +984,7 @@ packages: name: win32 url: "https://pub.dartlang.org" source: hosted - version: "2.2.9" + version: "2.2.10" xdg_directories: dependency: transitive description: diff --git a/test/base_provider_test.mocks.dart b/test/base_provider_test.mocks.dart index f5202981..c64ebdcf 100644 --- a/test/base_provider_test.mocks.dart +++ b/test/base_provider_test.mocks.dart @@ -80,4 +80,6 @@ class MockClient extends _i1.Mock implements _i4.Client { @override void close() => super.noSuchMethod(Invocation.method(#close, []), returnValueForMissingStub: null); + @override + String toString() => super.toString(); } diff --git a/test/gallery_screen_test.mocks.dart b/test/gallery_screen_test.mocks.dart index 70f32d24..b7864a90 100644 --- a/test/gallery_screen_test.mocks.dart +++ b/test/gallery_screen_test.mocks.dart @@ -60,6 +60,9 @@ class MockGalleryProvider extends _i1.Mock implements _i4.GalleryProvider { bool get hasListeners => (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) as bool); @override + void clear() => + super.noSuchMethod(Invocation.method(#clear, []), returnValueForMissingStub: null); + @override _i6.Future fetchAndSetGallery() => (super.noSuchMethod(Invocation.method(#fetchAndSetGallery, []), returnValue: Future.value(), @@ -105,6 +108,8 @@ class MockGalleryProvider extends _i1.Mock implements _i4.GalleryProvider { (super.noSuchMethod(Invocation.method(#deleteRequest, [url, id]), returnValue: Future<_i3.Response>.value(_FakeResponse_3())) as _i6.Future<_i3.Response>); @override + String toString() => super.toString(); + @override void addListener(_i8.VoidCallback? listener) => super .noSuchMethod(Invocation.method(#addListener, [listener]), returnValueForMissingStub: null); @override diff --git a/test/measurements/measurement_categories_screen_test.mocks.dart b/test/measurements/measurement_categories_screen_test.mocks.dart index 49095843..bc5f90a5 100644 --- a/test/measurements/measurement_categories_screen_test.mocks.dart +++ b/test/measurements/measurement_categories_screen_test.mocks.dart @@ -97,6 +97,8 @@ class MockMeasurementProvider extends _i1.Mock implements _i4.MeasurementProvide returnValue: Future.value(), returnValueForMissingStub: Future.value()) as _i5.Future); @override + String toString() => super.toString(); + @override void addListener(_i7.VoidCallback? listener) => super .noSuchMethod(Invocation.method(#addListener, [listener]), returnValueForMissingStub: null); @override diff --git a/test/measurements/measurement_provider_test.mocks.dart b/test/measurements/measurement_provider_test.mocks.dart index 7069098e..3d0ae4e9 100644 --- a/test/measurements/measurement_provider_test.mocks.dart +++ b/test/measurements/measurement_provider_test.mocks.dart @@ -71,4 +71,6 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { _i5.Future<_i3.Response> deleteRequest(String? url, int? id) => (super.noSuchMethod(Invocation.method(#deleteRequest, [url, id]), returnValue: Future<_i3.Response>.value(_FakeResponse_3())) as _i5.Future<_i3.Response>); + @override + String toString() => super.toString(); } diff --git a/test/nutritional_plan_form_test.mocks.dart b/test/nutritional_plan_form_test.mocks.dart index 04601728..a878141a 100644 --- a/test/nutritional_plan_form_test.mocks.dart +++ b/test/nutritional_plan_form_test.mocks.dart @@ -67,6 +67,9 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i8.NutritionPlansP bool get hasListeners => (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) as bool); @override + void clear() => + super.noSuchMethod(Invocation.method(#clear, []), returnValueForMissingStub: null); + @override _i4.NutritionalPlan findById(int? id) => (super.noSuchMethod(Invocation.method(#findById, [id]), returnValue: _FakeNutritionalPlan_2()) as _i4.NutritionalPlan); @@ -184,6 +187,8 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i8.NutritionPlansP (super.noSuchMethod(Invocation.method(#deleteRequest, [url, id]), returnValue: Future<_i3.Response>.value(_FakeResponse_7())) as _i9.Future<_i3.Response>); @override + String toString() => super.toString(); + @override void addListener(_i10.VoidCallback? listener) => super .noSuchMethod(Invocation.method(#addListener, [listener]), returnValueForMissingStub: null); @override diff --git a/test/workout_form_test.mocks.dart b/test/workout_form_test.mocks.dart index 68264575..9bfd1d08 100644 --- a/test/workout_form_test.mocks.dart +++ b/test/workout_form_test.mocks.dart @@ -96,6 +96,9 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i12.WorkoutPlansProv bool get hasListeners => (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) as bool); @override + void clear() => + super.noSuchMethod(Invocation.method(#clear, []), returnValueForMissingStub: null); + @override _i6.WorkoutPlan findById(int? id) => (super.noSuchMethod(Invocation.method(#findById, [id]), returnValue: _FakeWorkoutPlan_4()) as _i6.WorkoutPlan); @@ -222,6 +225,11 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i12.WorkoutPlansProv (super.noSuchMethod(Invocation.method(#addLog, [log]), returnValue: Future<_i11.Log>.value(_FakeLog_9())) as _i13.Future<_i11.Log>); @override + _i13.Future deleteLog(_i11.Log? log) => + (super.noSuchMethod(Invocation.method(#deleteLog, [log]), + returnValue: Future.value(), + returnValueForMissingStub: Future.value()) as _i13.Future); + @override Uri makeUrl(String? path, {int? id, String? objectMethod, Map? query}) => (super.noSuchMethod( Invocation.method( @@ -247,6 +255,8 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i12.WorkoutPlansProv Invocation.method(#deleteRequest, [url, id]), returnValue: Future<_i5.Response>.value(_FakeResponse_11())) as _i13.Future<_i5.Response>); @override + String toString() => super.toString(); + @override void addListener(_i15.VoidCallback? listener) => super .noSuchMethod(Invocation.method(#addListener, [listener]), returnValueForMissingStub: null); @override diff --git a/test/workout_set_form_test.mocks.dart b/test/workout_set_form_test.mocks.dart index 1cd1a15f..b6cef929 100644 --- a/test/workout_set_form_test.mocks.dart +++ b/test/workout_set_form_test.mocks.dart @@ -115,6 +115,8 @@ class MockExercisesProvider extends _i1.Mock implements _i5.ExercisesProvider { (super.noSuchMethod(Invocation.method(#deleteRequest, [url, id]), returnValue: Future<_i3.Response>.value(_FakeResponse_4())) as _i6.Future<_i3.Response>); @override + String toString() => super.toString(); + @override void addListener(_i7.VoidCallback? listener) => super .noSuchMethod(Invocation.method(#addListener, [listener]), returnValueForMissingStub: null); @override From a2d71653ccfb7c9429beaf8f51d35845a27b687d Mon Sep 17 00:00:00 2001 From: Github-actions Date: Sun, 24 Oct 2021 20:15:32 +0000 Subject: [PATCH 13/40] Automatic linting --- pubspec.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pubspec.lock b/pubspec.lock index a813d25c..7e215449 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -14,7 +14,7 @@ packages: name: analyzer url: "https://pub.dartlang.org" source: hosted - version: "1.7.1" + version: "1.7.2" android_metadata: dependency: "direct main" description: @@ -42,7 +42,7 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.6.1" + version: "2.8.1" boolean_selector: dependency: transitive description: @@ -133,7 +133,7 @@ packages: name: charcode url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "1.3.1" charts_common: dependency: transitive description: @@ -524,7 +524,7 @@ packages: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.3.0" + version: "1.7.0" mime: dependency: transitive description: @@ -823,7 +823,7 @@ packages: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.3.0" + version: "0.4.2" timing: dependency: transitive description: From 49333463ccf69213f2368bf9edc4f4a493c42dd9 Mon Sep 17 00:00:00 2001 From: Chris Klempau Date: Mon, 25 Oct 2021 13:34:21 +0000 Subject: [PATCH 14/40] Translated using Weblate (Spanish) Currently translated at 75.0% (3 of 4 strings) Translation: wger Workout Manager/Play Store Translate-URL: https://hosted.weblate.org/projects/wger/play-store/es/ --- android/fastlane/metadata/android/es/short_description.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 android/fastlane/metadata/android/es/short_description.txt diff --git a/android/fastlane/metadata/android/es/short_description.txt b/android/fastlane/metadata/android/es/short_description.txt new file mode 100644 index 00000000..25e569e9 --- /dev/null +++ b/android/fastlane/metadata/android/es/short_description.txt @@ -0,0 +1 @@ +Monitor de entrenamiento, peso y nutrición From b402f445a2b5028a38772ecb3e09daeaaed0f05b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandi=20Milohani=C4=87?= Date: Wed, 27 Oct 2021 18:01:43 +0200 Subject: [PATCH 15/40] Add quick access to logged products #79 --- lib/l10n/app_en.arb | 4 ++ lib/widgets/nutrition/forms.dart | 50 ++++++++++++++++++- lib/widgets/nutrition/meal.dart | 16 +++++- .../nutrition/nutritional_plan_detail.dart | 14 +++++- 4 files changed, 81 insertions(+), 3 deletions(-) diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb index 6c9235b7..6133b1fa 100644 --- a/lib/l10n/app_en.arb +++ b/lib/l10n/app_en.arb @@ -480,6 +480,10 @@ "@selectIngredient": { "description": "Error message when the user hasn't selected an ingredient from the autocompleter" }, + "recentlyUsedIngredients": "Recently used ingredients. Please select one of ingredients.", + "@recentlyUsedIngredients": { + "description": "A message when a user adds a new ingredient to a meal." + }, "selectImage": "Please select an image", "@selectImage": { "description": "Label and error message when the user hasn't selected an image to save" diff --git a/lib/widgets/nutrition/forms.dart b/lib/widgets/nutrition/forms.dart index f87aa94e..c567cc5a 100644 --- a/lib/widgets/nutrition/forms.dart +++ b/lib/widgets/nutrition/forms.dart @@ -29,6 +29,7 @@ import 'package:wger/models/nutrition/meal_item.dart'; import 'package:wger/models/nutrition/nutritional_plan.dart'; import 'package:wger/providers/nutrition.dart'; import 'package:wger/screens/nutritional_plan_screen.dart'; +import 'package:wger/widgets/nutrition/meal.dart'; class MealForm extends StatelessWidget { late Meal _meal; @@ -115,8 +116,9 @@ class MealForm extends StatelessWidget { class MealItemForm extends StatelessWidget { final Meal _meal; late MealItem _mealItem; + final List _listOfIngredientMeal; - MealItemForm(this._meal, [mealItem]) { + MealItemForm(this._meal, this._listOfIngredientMeal, [mealItem]) { _mealItem = mealItem ?? MealItem.empty(); _mealItem.mealId = _meal.id!; } @@ -127,6 +129,7 @@ class MealItemForm extends StatelessWidget { @override Widget build(BuildContext context) { + final String unit = AppLocalizations.of(context).g; return Container( margin: EdgeInsets.all(20), child: Form( @@ -200,6 +203,51 @@ class MealItemForm extends StatelessWidget { Navigator.of(context).pop(); }, ), + if (_listOfIngredientMeal.isNotEmpty) SizedBox(height: 10.0), + Container( + child: Text(AppLocalizations.of(context).recentlyUsedIngredients), + padding: EdgeInsets.all(10.0)), + Expanded( + child: Scrollbar( + isAlwaysShown: true, + child: ListView.builder( + itemCount: _listOfIngredientMeal.length, + shrinkWrap: true, + itemBuilder: (context, index) { + return Column( + children: [ + SizedBox( + width: double.infinity, + child: Row( + children: [ + Flexible( + child: TextButton( + child: Text( + '${_listOfIngredientMeal[index].ingredientQuantity.toStringAsFixed(0)}$unit ${_listOfIngredientMeal[index].ingredientName}', + overflow: TextOverflow.ellipsis, + ), + onPressed: () { + _ingredientController.text = + _listOfIngredientMeal[index].ingredientName; + _amountController.text = + _listOfIngredientMeal[index] + .ingredientQuantity + .toStringAsFixed(0); + _mealItem.ingredientId = + _listOfIngredientMeal[index].ingredientCode; + _mealItem.amount = _listOfIngredientMeal[index] + .ingredientQuantity; + }, + )), + ], + ), + ), + ], + ); + }, + ), + ), + ) ], ), ), diff --git a/lib/widgets/nutrition/meal.dart b/lib/widgets/nutrition/meal.dart index b9300276..d37cdb07 100644 --- a/lib/widgets/nutrition/meal.dart +++ b/lib/widgets/nutrition/meal.dart @@ -30,9 +30,11 @@ import 'package:wger/widgets/nutrition/helpers.dart'; class MealWidget extends StatefulWidget { final Meal _meal; + final List _listOfIngredientMeal; const MealWidget( this._meal, + this._listOfIngredientMeal, ); @override @@ -127,7 +129,7 @@ class _MealWidgetState extends State { FormScreen.routeName, arguments: FormScreenArguments( AppLocalizations.of(context).addIngredient, - MealItemForm(widget._meal), + MealItemForm(widget._meal, widget._listOfIngredientMeal), hasListView: true, ), ); @@ -140,6 +142,18 @@ class _MealWidgetState extends State { } } +class IngredientMeal { + final int ingredientCode; + final num ingredientQuantity; + final String ingredientName; + + const IngredientMeal( + this.ingredientCode, + this.ingredientQuantity, + this.ingredientName, + ); +} + class MealItemWidget extends StatelessWidget { final bool _expanded; final MealItem _item; diff --git a/lib/widgets/nutrition/nutritional_plan_detail.dart b/lib/widgets/nutrition/nutritional_plan_detail.dart index 529637a8..19b4b363 100644 --- a/lib/widgets/nutrition/nutritional_plan_detail.dart +++ b/lib/widgets/nutrition/nutritional_plan_detail.dart @@ -44,11 +44,23 @@ class NutritionalPlanDetailWidget extends StatelessWidget { ? _nutritionalPlan.gPerBodyKg(lastWeightEntry.weight, nutritionalValues) : null; + final List listOfIngredientMeal = []; + for (final meal in _nutritionalPlan.meals) { + for (final mealItems in meal.mealItems) { + final ingredientInList = listOfIngredientMeal.where( + (element) => element.ingredientCode == mealItems.ingredientId); + if (ingredientInList.isEmpty) { + listOfIngredientMeal.add(IngredientMeal(mealItems.ingredientId, + mealItems.amount, mealItems.ingredientObj.name)); + } + } + } + return SliverList( delegate: SliverChildListDelegate( [ SizedBox(height: 10), - ..._nutritionalPlan.meals.map((meal) => MealWidget(meal)).toList(), + ..._nutritionalPlan.meals.map((meal) => MealWidget(meal, listOfIngredientMeal)).toList(), Padding( padding: const EdgeInsets.all(8.0), child: ElevatedButton( From a87351b470863ad655c829161171a8a157a5c64b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandi=20Milohani=C4=87?= Date: Thu, 28 Oct 2021 11:08:51 +0200 Subject: [PATCH 16/40] Code fixing --- lib/widgets/nutrition/forms.dart | 17 +++++++---------- lib/widgets/nutrition/helpers.dart | 17 +++++++++++++++++ lib/widgets/nutrition/meal.dart | 15 ++------------- .../nutrition/nutritional_plan_detail.dart | 14 +++----------- 4 files changed, 29 insertions(+), 34 deletions(-) diff --git a/lib/widgets/nutrition/forms.dart b/lib/widgets/nutrition/forms.dart index c567cc5a..a334f102 100644 --- a/lib/widgets/nutrition/forms.dart +++ b/lib/widgets/nutrition/forms.dart @@ -24,12 +24,12 @@ import 'package:wger/exceptions/http_exception.dart'; import 'package:wger/helpers/consts.dart'; import 'package:wger/helpers/json.dart'; import 'package:wger/helpers/ui.dart'; +import 'package:wger/models/nutrition/log.dart'; import 'package:wger/models/nutrition/meal.dart'; import 'package:wger/models/nutrition/meal_item.dart'; import 'package:wger/models/nutrition/nutritional_plan.dart'; import 'package:wger/providers/nutrition.dart'; import 'package:wger/screens/nutritional_plan_screen.dart'; -import 'package:wger/widgets/nutrition/meal.dart'; class MealForm extends StatelessWidget { late Meal _meal; @@ -116,7 +116,7 @@ class MealForm extends StatelessWidget { class MealItemForm extends StatelessWidget { final Meal _meal; late MealItem _mealItem; - final List _listOfIngredientMeal; + final List _listOfIngredientMeal; MealItemForm(this._meal, this._listOfIngredientMeal, [mealItem]) { _mealItem = mealItem ?? MealItem.empty(); @@ -223,20 +223,17 @@ class MealItemForm extends StatelessWidget { Flexible( child: TextButton( child: Text( - '${_listOfIngredientMeal[index].ingredientQuantity.toStringAsFixed(0)}$unit ${_listOfIngredientMeal[index].ingredientName}', + '${_listOfIngredientMeal[index].amount.toStringAsFixed(0)}$unit ${_listOfIngredientMeal[index].ingredientObj.name}', overflow: TextOverflow.ellipsis, ), onPressed: () { _ingredientController.text = - _listOfIngredientMeal[index].ingredientName; + _listOfIngredientMeal[index].ingredientObj.name; _amountController.text = - _listOfIngredientMeal[index] - .ingredientQuantity - .toStringAsFixed(0); + _listOfIngredientMeal[index].amount.toStringAsFixed(0); _mealItem.ingredientId = - _listOfIngredientMeal[index].ingredientCode; - _mealItem.amount = _listOfIngredientMeal[index] - .ingredientQuantity; + _listOfIngredientMeal[index].ingredientId; + _mealItem.amount = _listOfIngredientMeal[index].amount; }, )), ], diff --git a/lib/widgets/nutrition/helpers.dart b/lib/widgets/nutrition/helpers.dart index 582282b4..70ed9388 100644 --- a/lib/widgets/nutrition/helpers.dart +++ b/lib/widgets/nutrition/helpers.dart @@ -18,6 +18,8 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; +import 'package:wger/models/nutrition/log.dart'; +import 'package:wger/models/nutrition/nutritional_plan.dart'; import 'package:wger/models/nutrition/nutritrional_values.dart'; import 'package:wger/widgets/core/core.dart'; @@ -48,3 +50,18 @@ List getMutedNutritionalValues(NutritionalValues values, BuildContext co ]; return out; } +List listOfIngredientsLog(NutritionalPlan nutritionalPlan) { + final List listOfIngredientMeal = []; + for (final meal in nutritionalPlan.meals) { + for (final mealItem in meal.mealItems) { + final ingredientInList = + listOfIngredientMeal.where((element) => element.ingredientId == mealItem.ingredientId); + if (ingredientInList.isEmpty) { + final log = Log.fromMealItem(mealItem, nutritionalPlan.id!, mealItem.id!); + log.ingredientObj = mealItem.ingredientObj; + listOfIngredientMeal.add(log); + } + } + } + return listOfIngredientMeal; +} \ No newline at end of file diff --git a/lib/widgets/nutrition/meal.dart b/lib/widgets/nutrition/meal.dart index d37cdb07..f69a3279 100644 --- a/lib/widgets/nutrition/meal.dart +++ b/lib/widgets/nutrition/meal.dart @@ -20,6 +20,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'package:provider/provider.dart'; import 'package:wger/helpers/consts.dart'; +import 'package:wger/models/nutrition/log.dart'; import 'package:wger/models/nutrition/meal.dart'; import 'package:wger/models/nutrition/meal_item.dart'; import 'package:wger/providers/nutrition.dart'; @@ -30,7 +31,7 @@ import 'package:wger/widgets/nutrition/helpers.dart'; class MealWidget extends StatefulWidget { final Meal _meal; - final List _listOfIngredientMeal; + final List _listOfIngredientMeal; const MealWidget( this._meal, @@ -142,18 +143,6 @@ class _MealWidgetState extends State { } } -class IngredientMeal { - final int ingredientCode; - final num ingredientQuantity; - final String ingredientName; - - const IngredientMeal( - this.ingredientCode, - this.ingredientQuantity, - this.ingredientName, - ); -} - class MealItemWidget extends StatelessWidget { final bool _expanded; final MealItem _item; diff --git a/lib/widgets/nutrition/nutritional_plan_detail.dart b/lib/widgets/nutrition/nutritional_plan_detail.dart index 19b4b363..5296168d 100644 --- a/lib/widgets/nutrition/nutritional_plan_detail.dart +++ b/lib/widgets/nutrition/nutritional_plan_detail.dart @@ -20,6 +20,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'package:intl/intl.dart'; import 'package:provider/provider.dart'; +import 'package:wger/models/nutrition/log.dart'; import 'package:wger/models/nutrition/nutritional_plan.dart'; import 'package:wger/models/nutrition/nutritrional_values.dart'; import 'package:wger/providers/body_weight.dart'; @@ -28,6 +29,7 @@ import 'package:wger/screens/nutritional_diary_screen.dart'; import 'package:wger/theme/theme.dart'; import 'package:wger/widgets/nutrition/charts.dart'; import 'package:wger/widgets/nutrition/forms.dart'; +import 'package:wger/widgets/nutrition/helpers.dart'; import 'package:wger/widgets/nutrition/meal.dart'; class NutritionalPlanDetailWidget extends StatelessWidget { @@ -44,17 +46,7 @@ class NutritionalPlanDetailWidget extends StatelessWidget { ? _nutritionalPlan.gPerBodyKg(lastWeightEntry.weight, nutritionalValues) : null; - final List listOfIngredientMeal = []; - for (final meal in _nutritionalPlan.meals) { - for (final mealItems in meal.mealItems) { - final ingredientInList = listOfIngredientMeal.where( - (element) => element.ingredientCode == mealItems.ingredientId); - if (ingredientInList.isEmpty) { - listOfIngredientMeal.add(IngredientMeal(mealItems.ingredientId, - mealItems.amount, mealItems.ingredientObj.name)); - } - } - } + final List listOfIngredientMeal = listOfIngredientsLog(_nutritionalPlan); return SliverList( delegate: SliverChildListDelegate( From cfed2219745e4d44eef96cdc0f6ffa5672bb4126 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandi=20Milohani=C4=87?= Date: Thu, 28 Oct 2021 11:14:09 +0200 Subject: [PATCH 17/40] fix --- lib/widgets/nutrition/forms.dart | 2 +- lib/widgets/nutrition/nutritional_plan_detail.dart | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/widgets/nutrition/forms.dart b/lib/widgets/nutrition/forms.dart index a334f102..92535f5a 100644 --- a/lib/widgets/nutrition/forms.dart +++ b/lib/widgets/nutrition/forms.dart @@ -115,7 +115,7 @@ class MealForm extends StatelessWidget { class MealItemForm extends StatelessWidget { final Meal _meal; - late MealItem _mealItem; + late final MealItem _mealItem; final List _listOfIngredientMeal; MealItemForm(this._meal, this._listOfIngredientMeal, [mealItem]) { diff --git a/lib/widgets/nutrition/nutritional_plan_detail.dart b/lib/widgets/nutrition/nutritional_plan_detail.dart index 5296168d..9c4c4ede 100644 --- a/lib/widgets/nutrition/nutritional_plan_detail.dart +++ b/lib/widgets/nutrition/nutritional_plan_detail.dart @@ -51,7 +51,7 @@ class NutritionalPlanDetailWidget extends StatelessWidget { return SliverList( delegate: SliverChildListDelegate( [ - SizedBox(height: 10), + const SizedBox(height: 10), ..._nutritionalPlan.meals.map((meal) => MealWidget(meal, listOfIngredientMeal)).toList(), Padding( padding: const EdgeInsets.all(8.0), From 27eef231f1a0dfac7e4a75f5980217f59bf2ecec Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Thu, 28 Oct 2021 11:28:11 +0200 Subject: [PATCH 18/40] Bump dependencies --- pubspec.lock | 16 ++++++++-------- pubspec.yaml | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/pubspec.lock b/pubspec.lock index 7e215449..ed2de5b6 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -14,7 +14,7 @@ packages: name: analyzer url: "https://pub.dartlang.org" source: hosted - version: "1.7.2" + version: "1.7.1" android_metadata: dependency: "direct main" description: @@ -42,7 +42,7 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.8.1" + version: "2.6.1" boolean_selector: dependency: transitive description: @@ -105,7 +105,7 @@ packages: name: built_value url: "https://pub.dartlang.org" source: hosted - version: "8.1.2" + version: "8.1.3" camera: dependency: "direct main" description: @@ -133,7 +133,7 @@ packages: name: charcode url: "https://pub.dartlang.org" source: hosted - version: "1.3.1" + version: "1.2.0" charts_common: dependency: transitive description: @@ -210,7 +210,7 @@ packages: name: cross_file url: "https://pub.dartlang.org" source: hosted - version: "0.3.1+5" + version: "0.3.2" crypto: dependency: transitive description: @@ -524,7 +524,7 @@ packages: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.7.0" + version: "1.3.0" mime: dependency: transitive description: @@ -692,7 +692,7 @@ packages: name: rive url: "https://pub.dartlang.org" source: hosted - version: "0.7.32" + version: "0.7.33" shared_preferences: dependency: "direct main" description: @@ -823,7 +823,7 @@ packages: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.4.2" + version: "0.3.0" timing: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 0ce89ea2..ac73cd78 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -47,7 +47,7 @@ dependencies: version: ^2.0.0 package_info: ^2.0.2 provider: ^5.0.0 - rive: ^0.7.28 + rive: ^0.7.33 shared_preferences: ^2.0.7 table_calendar: ^3.0.2 url_launcher: ^6.0.10 From a4e381e4c8b13a34c30a5acc4f1d5d88238686ad Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Thu, 28 Oct 2021 11:43:32 +0200 Subject: [PATCH 19/40] Make order of sets a required attribute Closes #109 --- lib/models/workouts/set.dart | 4 ++-- lib/models/workouts/set.g.dart | 2 +- lib/widgets/workouts/day.dart | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/models/workouts/set.dart b/lib/models/workouts/set.dart index 54c39ced..a158476b 100644 --- a/lib/models/workouts/set.dart +++ b/lib/models/workouts/set.dart @@ -36,7 +36,7 @@ class Set { late int day; @JsonKey(required: true) - int? order; + late int order; @JsonKey(required: true, defaultValue: '') late String comment; @@ -58,7 +58,7 @@ class Set { Set({ required this.day, required this.sets, - this.order, + required this.order, }); Set.empty(); diff --git a/lib/models/workouts/set.g.dart b/lib/models/workouts/set.g.dart index 68ae9e81..9c6f83e2 100644 --- a/lib/models/workouts/set.g.dart +++ b/lib/models/workouts/set.g.dart @@ -11,7 +11,7 @@ Set _$SetFromJson(Map json) { return Set( day: json['exerciseday'] as int, sets: json['sets'] as int, - order: json['order'] as int?, + order: json['order'] as int, ) ..id = json['id'] as int? ..comment = json['comment'] as String? ?? ''; diff --git a/lib/widgets/workouts/day.dart b/lib/widgets/workouts/day.dart index b334ea67..e3eaba0a 100644 --- a/lib/widgets/workouts/day.dart +++ b/lib/widgets/workouts/day.dart @@ -101,7 +101,7 @@ class _WorkoutDayWidgetState extends State { void initState() { super.initState(); _sets = widget._day.sets; - _sets.sort((a, b) => a.order!.compareTo(b.order!)); + _sets.sort((a, b) => a.order.compareTo(b.order)); } void _toggleExpanded() { From ea8eada7ac30d4c474f289aae590a9a9086fd18a Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Thu, 28 Oct 2021 11:43:44 +0200 Subject: [PATCH 20/40] Commit generated mock files --- test/gallery_screen_test.mocks.dart | 69 ++--- ...surement_categories_screen_test.mocks.dart | 59 +++-- test/nutritional_plan_form_test.mocks.dart | 109 ++++---- test/workout_form_test.mocks.dart | 244 ++++++++++-------- test/workout_set_form_test.mocks.dart | 82 +++--- 5 files changed, 321 insertions(+), 242 deletions(-) diff --git a/test/gallery_screen_test.mocks.dart b/test/gallery_screen_test.mocks.dart index b7864a90..973b4ce7 100644 --- a/test/gallery_screen_test.mocks.dart +++ b/test/gallery_screen_test.mocks.dart @@ -37,31 +37,33 @@ class MockGalleryProvider extends _i1.Mock implements _i4.GalleryProvider { } @override - List<_i5.Image> get images => - (super.noSuchMethod(Invocation.getter(#images), returnValue: <_i5.Image>[]) - as List<_i5.Image>); + List<_i5.Image> get images => (super.noSuchMethod(Invocation.getter(#images), + returnValue: <_i5.Image>[]) as List<_i5.Image>); @override set images(List<_i5.Image>? _images) => - super.noSuchMethod(Invocation.setter(#images, _images), returnValueForMissingStub: null); + super.noSuchMethod(Invocation.setter(#images, _images), + returnValueForMissingStub: null); @override - _i2.AuthProvider get auth => - (super.noSuchMethod(Invocation.getter(#auth), returnValue: _FakeAuthProvider_0()) - as _i2.AuthProvider); + _i2.AuthProvider get auth => (super.noSuchMethod(Invocation.getter(#auth), + returnValue: _FakeAuthProvider_0()) as _i2.AuthProvider); @override set auth(_i2.AuthProvider? _auth) => - super.noSuchMethod(Invocation.setter(#auth, _auth), returnValueForMissingStub: null); + super.noSuchMethod(Invocation.setter(#auth, _auth), + returnValueForMissingStub: null); @override - _i3.Client get client => - (super.noSuchMethod(Invocation.getter(#client), returnValue: _FakeClient_1()) as _i3.Client); + _i3.Client get client => (super.noSuchMethod(Invocation.getter(#client), + returnValue: _FakeClient_1()) as _i3.Client); @override set client(_i3.Client? _client) => - super.noSuchMethod(Invocation.setter(#client, _client), returnValueForMissingStub: null); + super.noSuchMethod(Invocation.setter(#client, _client), + returnValueForMissingStub: null); @override bool get hasListeners => - (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) as bool); + (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) + as bool); @override - void clear() => - super.noSuchMethod(Invocation.method(#clear, []), returnValueForMissingStub: null); + void clear() => super.noSuchMethod(Invocation.method(#clear, []), + returnValueForMissingStub: null); @override _i6.Future fetchAndSetGallery() => (super.noSuchMethod(Invocation.method(#fetchAndSetGallery, []), @@ -83,43 +85,50 @@ class MockGalleryProvider extends _i1.Mock implements _i4.GalleryProvider { returnValue: Future.value(), returnValueForMissingStub: Future.value()) as _i6.Future); @override - Uri makeUrl(String? path, {int? id, String? objectMethod, Map? query}) => + Uri makeUrl(String? path, + {int? id, String? objectMethod, Map? query}) => (super.noSuchMethod( - Invocation.method( - #makeUrl, [path], {#id: id, #objectMethod: objectMethod, #query: query}), + Invocation.method(#makeUrl, [path], + {#id: id, #objectMethod: objectMethod, #query: query}), returnValue: _FakeUri_2()) as Uri); @override - _i6.Future> fetch(Uri? uri) => - (super.noSuchMethod(Invocation.method(#fetch, [uri]), - returnValue: Future>.value({})) - as _i6.Future>); + _i6.Future> fetch(Uri? uri) => (super.noSuchMethod( + Invocation.method(#fetch, [uri]), + returnValue: Future>.value({})) + as _i6.Future>); @override _i6.Future> post(Map? data, Uri? uri) => (super.noSuchMethod(Invocation.method(#post, [data, uri]), - returnValue: Future>.value({})) + returnValue: + Future>.value({})) as _i6.Future>); @override - _i6.Future> patch(Map? data, Uri? uri) => + _i6.Future> patch( + Map? data, Uri? uri) => (super.noSuchMethod(Invocation.method(#patch, [data, uri]), - returnValue: Future>.value({})) + returnValue: + Future>.value({})) as _i6.Future>); @override _i6.Future<_i3.Response> deleteRequest(String? url, int? id) => (super.noSuchMethod(Invocation.method(#deleteRequest, [url, id]), - returnValue: Future<_i3.Response>.value(_FakeResponse_3())) as _i6.Future<_i3.Response>); + returnValue: Future<_i3.Response>.value(_FakeResponse_3())) + as _i6.Future<_i3.Response>); @override String toString() => super.toString(); @override - void addListener(_i8.VoidCallback? listener) => super - .noSuchMethod(Invocation.method(#addListener, [listener]), returnValueForMissingStub: null); + void addListener(_i8.VoidCallback? listener) => + super.noSuchMethod(Invocation.method(#addListener, [listener]), + returnValueForMissingStub: null); @override void removeListener(_i8.VoidCallback? listener) => super.noSuchMethod(Invocation.method(#removeListener, [listener]), returnValueForMissingStub: null); @override - void dispose() => - super.noSuchMethod(Invocation.method(#dispose, []), returnValueForMissingStub: null); + void dispose() => super.noSuchMethod(Invocation.method(#dispose, []), + returnValueForMissingStub: null); @override void notifyListeners() => - super.noSuchMethod(Invocation.method(#notifyListeners, []), returnValueForMissingStub: null); + super.noSuchMethod(Invocation.method(#notifyListeners, []), + returnValueForMissingStub: null); } diff --git a/test/measurements/measurement_categories_screen_test.mocks.dart b/test/measurements/measurement_categories_screen_test.mocks.dart index bc5f90a5..f3b33bb4 100644 --- a/test/measurements/measurement_categories_screen_test.mocks.dart +++ b/test/measurements/measurement_categories_screen_test.mocks.dart @@ -19,36 +19,41 @@ import 'package:wger/providers/measurement.dart' as _i4; // ignore_for_file: prefer_const_constructors // ignore_for_file: unnecessary_parenthesis -class _FakeWgerBaseProvider_0 extends _i1.Fake implements _i2.WgerBaseProvider {} +class _FakeWgerBaseProvider_0 extends _i1.Fake implements _i2.WgerBaseProvider { +} -class _FakeMeasurementCategory_1 extends _i1.Fake implements _i3.MeasurementCategory {} +class _FakeMeasurementCategory_1 extends _i1.Fake + implements _i3.MeasurementCategory {} /// A class which mocks [MeasurementProvider]. /// /// See the documentation for Mockito's code generation for more information. -class MockMeasurementProvider extends _i1.Mock implements _i4.MeasurementProvider { +class MockMeasurementProvider extends _i1.Mock + implements _i4.MeasurementProvider { MockMeasurementProvider() { _i1.throwOnMissingStub(this); } @override _i2.WgerBaseProvider get baseProvider => - (super.noSuchMethod(Invocation.getter(#baseProvider), returnValue: _FakeWgerBaseProvider_0()) - as _i2.WgerBaseProvider); + (super.noSuchMethod(Invocation.getter(#baseProvider), + returnValue: _FakeWgerBaseProvider_0()) as _i2.WgerBaseProvider); @override List<_i3.MeasurementCategory> get categories => - (super.noSuchMethod(Invocation.getter(#categories), returnValue: <_i3.MeasurementCategory>[]) + (super.noSuchMethod(Invocation.getter(#categories), + returnValue: <_i3.MeasurementCategory>[]) as List<_i3.MeasurementCategory>); @override bool get hasListeners => - (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) as bool); + (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) + as bool); @override - void clear() => - super.noSuchMethod(Invocation.method(#clear, []), returnValueForMissingStub: null); + void clear() => super.noSuchMethod(Invocation.method(#clear, []), + returnValueForMissingStub: null); @override - _i3.MeasurementCategory findCategoryById(int? id) => - (super.noSuchMethod(Invocation.method(#findCategoryById, [id]), - returnValue: _FakeMeasurementCategory_1()) as _i3.MeasurementCategory); + _i3.MeasurementCategory findCategoryById(int? id) => (super.noSuchMethod( + Invocation.method(#findCategoryById, [id]), + returnValue: _FakeMeasurementCategory_1()) as _i3.MeasurementCategory); @override _i5.Future fetchAndSetCategories() => (super.noSuchMethod(Invocation.method(#fetchAndSetCategories, []), @@ -60,10 +65,10 @@ class MockMeasurementProvider extends _i1.Mock implements _i4.MeasurementProvide returnValue: Future.value(), returnValueForMissingStub: Future.value()) as _i5.Future); @override - _i5.Future fetchAndSetAllCategoriesAndEntries() => - (super.noSuchMethod(Invocation.method(#fetchAndSetAllCategoriesAndEntries, []), - returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i5.Future); + _i5.Future fetchAndSetAllCategoriesAndEntries() => (super.noSuchMethod( + Invocation.method(#fetchAndSetAllCategoriesAndEntries, []), + returnValue: Future.value(), + returnValueForMissingStub: Future.value()) as _i5.Future); @override _i5.Future addCategory(_i3.MeasurementCategory? category) => (super.noSuchMethod(Invocation.method(#addCategory, [category]), @@ -76,7 +81,8 @@ class MockMeasurementProvider extends _i1.Mock implements _i4.MeasurementProvide returnValueForMissingStub: Future.value()) as _i5.Future); @override _i5.Future editCategory(int? id, String? newName, String? newUnit) => - (super.noSuchMethod(Invocation.method(#editCategory, [id, newName, newUnit]), + (super.noSuchMethod( + Invocation.method(#editCategory, [id, newName, newUnit]), returnValue: Future.value(), returnValueForMissingStub: Future.value()) as _i5.Future); @override @@ -90,25 +96,28 @@ class MockMeasurementProvider extends _i1.Mock implements _i4.MeasurementProvide returnValue: Future.value(), returnValueForMissingStub: Future.value()) as _i5.Future); @override - _i5.Future editEntry( - int? id, int? categoryId, num? newValue, String? newNotes, DateTime? newDate) => + _i5.Future editEntry(int? id, int? categoryId, num? newValue, + String? newNotes, DateTime? newDate) => (super.noSuchMethod( - Invocation.method(#editEntry, [id, categoryId, newValue, newNotes, newDate]), + Invocation.method( + #editEntry, [id, categoryId, newValue, newNotes, newDate]), returnValue: Future.value(), returnValueForMissingStub: Future.value()) as _i5.Future); @override String toString() => super.toString(); @override - void addListener(_i7.VoidCallback? listener) => super - .noSuchMethod(Invocation.method(#addListener, [listener]), returnValueForMissingStub: null); + void addListener(_i7.VoidCallback? listener) => + super.noSuchMethod(Invocation.method(#addListener, [listener]), + returnValueForMissingStub: null); @override void removeListener(_i7.VoidCallback? listener) => super.noSuchMethod(Invocation.method(#removeListener, [listener]), returnValueForMissingStub: null); @override - void dispose() => - super.noSuchMethod(Invocation.method(#dispose, []), returnValueForMissingStub: null); + void dispose() => super.noSuchMethod(Invocation.method(#dispose, []), + returnValueForMissingStub: null); @override void notifyListeners() => - super.noSuchMethod(Invocation.method(#notifyListeners, []), returnValueForMissingStub: null); + super.noSuchMethod(Invocation.method(#notifyListeners, []), + returnValueForMissingStub: null); } diff --git a/test/nutritional_plan_form_test.mocks.dart b/test/nutritional_plan_form_test.mocks.dart index a878141a..ec5bfd5f 100644 --- a/test/nutritional_plan_form_test.mocks.dart +++ b/test/nutritional_plan_form_test.mocks.dart @@ -41,38 +41,41 @@ class _FakeResponse_7 extends _i1.Fake implements _i3.Response {} /// A class which mocks [NutritionPlansProvider]. /// /// See the documentation for Mockito's code generation for more information. -class MockNutritionPlansProvider extends _i1.Mock implements _i8.NutritionPlansProvider { +class MockNutritionPlansProvider extends _i1.Mock + implements _i8.NutritionPlansProvider { MockNutritionPlansProvider() { _i1.throwOnMissingStub(this); } @override List<_i4.NutritionalPlan> get items => - (super.noSuchMethod(Invocation.getter(#items), returnValue: <_i4.NutritionalPlan>[]) - as List<_i4.NutritionalPlan>); + (super.noSuchMethod(Invocation.getter(#items), + returnValue: <_i4.NutritionalPlan>[]) as List<_i4.NutritionalPlan>); @override - _i2.AuthProvider get auth => - (super.noSuchMethod(Invocation.getter(#auth), returnValue: _FakeAuthProvider_0()) - as _i2.AuthProvider); + _i2.AuthProvider get auth => (super.noSuchMethod(Invocation.getter(#auth), + returnValue: _FakeAuthProvider_0()) as _i2.AuthProvider); @override set auth(_i2.AuthProvider? _auth) => - super.noSuchMethod(Invocation.setter(#auth, _auth), returnValueForMissingStub: null); + super.noSuchMethod(Invocation.setter(#auth, _auth), + returnValueForMissingStub: null); @override - _i3.Client get client => - (super.noSuchMethod(Invocation.getter(#client), returnValue: _FakeClient_1()) as _i3.Client); + _i3.Client get client => (super.noSuchMethod(Invocation.getter(#client), + returnValue: _FakeClient_1()) as _i3.Client); @override set client(_i3.Client? _client) => - super.noSuchMethod(Invocation.setter(#client, _client), returnValueForMissingStub: null); + super.noSuchMethod(Invocation.setter(#client, _client), + returnValueForMissingStub: null); @override bool get hasListeners => - (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) as bool); + (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) + as bool); @override - void clear() => - super.noSuchMethod(Invocation.method(#clear, []), returnValueForMissingStub: null); + void clear() => super.noSuchMethod(Invocation.method(#clear, []), + returnValueForMissingStub: null); @override _i4.NutritionalPlan findById(int? id) => - (super.noSuchMethod(Invocation.method(#findById, [id]), returnValue: _FakeNutritionalPlan_2()) - as _i4.NutritionalPlan); + (super.noSuchMethod(Invocation.method(#findById, [id]), + returnValue: _FakeNutritionalPlan_2()) as _i4.NutritionalPlan); @override _i5.Meal? findMealById(int? id) => (super.noSuchMethod(Invocation.method(#findMealById, [id])) as _i5.Meal?); @@ -89,17 +92,20 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i8.NutritionPlansP @override _i9.Future<_i4.NutritionalPlan> fetchAndSetPlanSparse(int? planId) => (super.noSuchMethod(Invocation.method(#fetchAndSetPlanSparse, [planId]), - returnValue: Future<_i4.NutritionalPlan>.value(_FakeNutritionalPlan_2())) + returnValue: + Future<_i4.NutritionalPlan>.value(_FakeNutritionalPlan_2())) as _i9.Future<_i4.NutritionalPlan>); @override _i9.Future<_i4.NutritionalPlan> fetchAndSetPlanFull(int? planId) => (super.noSuchMethod(Invocation.method(#fetchAndSetPlanFull, [planId]), - returnValue: Future<_i4.NutritionalPlan>.value(_FakeNutritionalPlan_2())) + returnValue: + Future<_i4.NutritionalPlan>.value(_FakeNutritionalPlan_2())) as _i9.Future<_i4.NutritionalPlan>); @override _i9.Future<_i4.NutritionalPlan> addPlan(_i4.NutritionalPlan? planData) => (super.noSuchMethod(Invocation.method(#addPlan, [planData]), - returnValue: Future<_i4.NutritionalPlan>.value(_FakeNutritionalPlan_2())) + returnValue: + Future<_i4.NutritionalPlan>.value(_FakeNutritionalPlan_2())) as _i9.Future<_i4.NutritionalPlan>); @override _i9.Future editPlan(_i4.NutritionalPlan? plan) => @@ -107,26 +113,31 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i8.NutritionPlansP returnValue: Future.value(), returnValueForMissingStub: Future.value()) as _i9.Future); @override - _i9.Future deletePlan(int? id) => (super.noSuchMethod(Invocation.method(#deletePlan, [id]), - returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i9.Future); + _i9.Future deletePlan(int? id) => + (super.noSuchMethod(Invocation.method(#deletePlan, [id]), + returnValue: Future.value(), + returnValueForMissingStub: Future.value()) as _i9.Future); @override _i9.Future<_i5.Meal> addMeal(_i5.Meal? meal, int? planId) => (super.noSuchMethod(Invocation.method(#addMeal, [meal, planId]), - returnValue: Future<_i5.Meal>.value(_FakeMeal_3())) as _i9.Future<_i5.Meal>); + returnValue: Future<_i5.Meal>.value(_FakeMeal_3())) + as _i9.Future<_i5.Meal>); @override _i9.Future<_i5.Meal> editMeal(_i5.Meal? meal) => (super.noSuchMethod(Invocation.method(#editMeal, [meal]), - returnValue: Future<_i5.Meal>.value(_FakeMeal_3())) as _i9.Future<_i5.Meal>); + returnValue: Future<_i5.Meal>.value(_FakeMeal_3())) + as _i9.Future<_i5.Meal>); @override _i9.Future deleteMeal(_i5.Meal? meal) => (super.noSuchMethod(Invocation.method(#deleteMeal, [meal]), returnValue: Future.value(), returnValueForMissingStub: Future.value()) as _i9.Future); @override - _i9.Future<_i6.MealItem> addMealItem(_i6.MealItem? mealItem, _i5.Meal? meal) => + _i9.Future<_i6.MealItem> addMealItem( + _i6.MealItem? mealItem, _i5.Meal? meal) => (super.noSuchMethod(Invocation.method(#addMealItem, [mealItem, meal]), - returnValue: Future<_i6.MealItem>.value(_FakeMealItem_4())) as _i9.Future<_i6.MealItem>); + returnValue: Future<_i6.MealItem>.value(_FakeMealItem_4())) + as _i9.Future<_i6.MealItem>); @override _i9.Future deleteMealItem(_i6.MealItem? mealItem) => (super.noSuchMethod(Invocation.method(#deleteMealItem, [mealItem]), @@ -143,9 +154,12 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i8.NutritionPlansP returnValue: Future.value(), returnValueForMissingStub: Future.value()) as _i9.Future); @override - _i9.Future> searchIngredient(String? name, [String? languageCode = r'en']) => - (super.noSuchMethod(Invocation.method(#searchIngredient, [name, languageCode]), - returnValue: Future>.value([])) as _i9.Future>); + _i9.Future> searchIngredient(String? name, + [String? languageCode = r'en']) => + (super.noSuchMethod( + Invocation.method(#searchIngredient, [name, languageCode]), + returnValue: Future>.value([])) + as _i9.Future>); @override _i9.Future logMealToDiary(_i5.Meal? meal) => (super.noSuchMethod(Invocation.method(#logMealToDiary, [meal]), @@ -162,43 +176,50 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i8.NutritionPlansP returnValue: Future.value(), returnValueForMissingStub: Future.value()) as _i9.Future); @override - Uri makeUrl(String? path, {int? id, String? objectMethod, Map? query}) => + Uri makeUrl(String? path, + {int? id, String? objectMethod, Map? query}) => (super.noSuchMethod( - Invocation.method( - #makeUrl, [path], {#id: id, #objectMethod: objectMethod, #query: query}), + Invocation.method(#makeUrl, [path], + {#id: id, #objectMethod: objectMethod, #query: query}), returnValue: _FakeUri_6()) as Uri); @override - _i9.Future> fetch(Uri? uri) => - (super.noSuchMethod(Invocation.method(#fetch, [uri]), - returnValue: Future>.value({})) - as _i9.Future>); + _i9.Future> fetch(Uri? uri) => (super.noSuchMethod( + Invocation.method(#fetch, [uri]), + returnValue: Future>.value({})) + as _i9.Future>); @override _i9.Future> post(Map? data, Uri? uri) => (super.noSuchMethod(Invocation.method(#post, [data, uri]), - returnValue: Future>.value({})) + returnValue: + Future>.value({})) as _i9.Future>); @override - _i9.Future> patch(Map? data, Uri? uri) => + _i9.Future> patch( + Map? data, Uri? uri) => (super.noSuchMethod(Invocation.method(#patch, [data, uri]), - returnValue: Future>.value({})) + returnValue: + Future>.value({})) as _i9.Future>); @override _i9.Future<_i3.Response> deleteRequest(String? url, int? id) => (super.noSuchMethod(Invocation.method(#deleteRequest, [url, id]), - returnValue: Future<_i3.Response>.value(_FakeResponse_7())) as _i9.Future<_i3.Response>); + returnValue: Future<_i3.Response>.value(_FakeResponse_7())) + as _i9.Future<_i3.Response>); @override String toString() => super.toString(); @override - void addListener(_i10.VoidCallback? listener) => super - .noSuchMethod(Invocation.method(#addListener, [listener]), returnValueForMissingStub: null); + void addListener(_i10.VoidCallback? listener) => + super.noSuchMethod(Invocation.method(#addListener, [listener]), + returnValueForMissingStub: null); @override void removeListener(_i10.VoidCallback? listener) => super.noSuchMethod(Invocation.method(#removeListener, [listener]), returnValueForMissingStub: null); @override - void dispose() => - super.noSuchMethod(Invocation.method(#dispose, []), returnValueForMissingStub: null); + void dispose() => super.noSuchMethod(Invocation.method(#dispose, []), + returnValueForMissingStub: null); @override void notifyListeners() => - super.noSuchMethod(Invocation.method(#notifyListeners, []), returnValueForMissingStub: null); + super.noSuchMethod(Invocation.method(#notifyListeners, []), + returnValueForMissingStub: null); } diff --git a/test/workout_form_test.mocks.dart b/test/workout_form_test.mocks.dart index 9bfd1d08..62ef2499 100644 --- a/test/workout_form_test.mocks.dart +++ b/test/workout_form_test.mocks.dart @@ -54,73 +54,79 @@ class _FakeResponse_11 extends _i1.Fake implements _i5.Response {} /// A class which mocks [WorkoutPlansProvider]. /// /// See the documentation for Mockito's code generation for more information. -class MockWorkoutPlansProvider extends _i1.Mock implements _i12.WorkoutPlansProvider { +class MockWorkoutPlansProvider extends _i1.Mock + implements _i12.WorkoutPlansProvider { MockWorkoutPlansProvider() { _i1.throwOnMissingStub(this); } @override List<_i6.WorkoutPlan> get items => - (super.noSuchMethod(Invocation.getter(#items), returnValue: <_i6.WorkoutPlan>[]) - as List<_i6.WorkoutPlan>); + (super.noSuchMethod(Invocation.getter(#items), + returnValue: <_i6.WorkoutPlan>[]) as List<_i6.WorkoutPlan>); @override List<_i2.WeightUnit> get weightUnits => - (super.noSuchMethod(Invocation.getter(#weightUnits), returnValue: <_i2.WeightUnit>[]) - as List<_i2.WeightUnit>); + (super.noSuchMethod(Invocation.getter(#weightUnits), + returnValue: <_i2.WeightUnit>[]) as List<_i2.WeightUnit>); @override _i2.WeightUnit get defaultWeightUnit => - (super.noSuchMethod(Invocation.getter(#defaultWeightUnit), returnValue: _FakeWeightUnit_0()) - as _i2.WeightUnit); + (super.noSuchMethod(Invocation.getter(#defaultWeightUnit), + returnValue: _FakeWeightUnit_0()) as _i2.WeightUnit); @override List<_i3.RepetitionUnit> get repetitionUnits => - (super.noSuchMethod(Invocation.getter(#repetitionUnits), returnValue: <_i3.RepetitionUnit>[]) - as List<_i3.RepetitionUnit>); + (super.noSuchMethod(Invocation.getter(#repetitionUnits), + returnValue: <_i3.RepetitionUnit>[]) as List<_i3.RepetitionUnit>); @override _i3.RepetitionUnit get defaultRepetitionUnit => (super.noSuchMethod(Invocation.getter(#defaultRepetitionUnit), returnValue: _FakeRepetitionUnit_1()) as _i3.RepetitionUnit); @override - _i4.AuthProvider get auth => - (super.noSuchMethod(Invocation.getter(#auth), returnValue: _FakeAuthProvider_2()) - as _i4.AuthProvider); + _i4.AuthProvider get auth => (super.noSuchMethod(Invocation.getter(#auth), + returnValue: _FakeAuthProvider_2()) as _i4.AuthProvider); @override set auth(_i4.AuthProvider? _auth) => - super.noSuchMethod(Invocation.setter(#auth, _auth), returnValueForMissingStub: null); + super.noSuchMethod(Invocation.setter(#auth, _auth), + returnValueForMissingStub: null); @override - _i5.Client get client => - (super.noSuchMethod(Invocation.getter(#client), returnValue: _FakeClient_3()) as _i5.Client); + _i5.Client get client => (super.noSuchMethod(Invocation.getter(#client), + returnValue: _FakeClient_3()) as _i5.Client); @override set client(_i5.Client? _client) => - super.noSuchMethod(Invocation.setter(#client, _client), returnValueForMissingStub: null); + super.noSuchMethod(Invocation.setter(#client, _client), + returnValueForMissingStub: null); @override bool get hasListeners => - (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) as bool); + (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) + as bool); @override - void clear() => - super.noSuchMethod(Invocation.method(#clear, []), returnValueForMissingStub: null); + void clear() => super.noSuchMethod(Invocation.method(#clear, []), + returnValueForMissingStub: null); @override _i6.WorkoutPlan findById(int? id) => - (super.noSuchMethod(Invocation.method(#findById, [id]), returnValue: _FakeWorkoutPlan_4()) - as _i6.WorkoutPlan); + (super.noSuchMethod(Invocation.method(#findById, [id]), + returnValue: _FakeWorkoutPlan_4()) as _i6.WorkoutPlan); @override - int findIndexById(int? id) => - (super.noSuchMethod(Invocation.method(#findIndexById, [id]), returnValue: 0) as int); + int findIndexById(int? id) => (super + .noSuchMethod(Invocation.method(#findIndexById, [id]), returnValue: 0) + as int); @override void setCurrentPlan(int? id) => - super.noSuchMethod(Invocation.method(#setCurrentPlan, [id]), returnValueForMissingStub: null); + super.noSuchMethod(Invocation.method(#setCurrentPlan, [id]), + returnValueForMissingStub: null); @override void resetCurrentPlan() => - super.noSuchMethod(Invocation.method(#resetCurrentPlan, []), returnValueForMissingStub: null); + super.noSuchMethod(Invocation.method(#resetCurrentPlan, []), + returnValueForMissingStub: null); @override - _i13.Future fetchAndSetAllPlansFull() => - (super.noSuchMethod(Invocation.method(#fetchAndSetAllPlansFull, []), - returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i13.Future); + _i13.Future fetchAndSetAllPlansFull() => (super.noSuchMethod( + Invocation.method(#fetchAndSetAllPlansFull, []), + returnValue: Future.value(), + returnValueForMissingStub: Future.value()) as _i13.Future); @override - _i13.Future fetchAndSetAllPlansSparse() => - (super.noSuchMethod(Invocation.method(#fetchAndSetAllPlansSparse, []), - returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i13.Future); + _i13.Future fetchAndSetAllPlansSparse() => (super.noSuchMethod( + Invocation.method(#fetchAndSetAllPlansSparse, []), + returnValue: Future.value(), + returnValueForMissingStub: Future.value()) as _i13.Future); @override _i13.Future<_i6.WorkoutPlan> fetchAndSetPlanSparse(int? planId) => (super.noSuchMethod(Invocation.method(#fetchAndSetPlanSparse, [planId]), @@ -128,7 +134,8 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i12.WorkoutPlansProv as _i13.Future<_i6.WorkoutPlan>); @override _i13.Future<_i6.WorkoutPlan> fetchAndSetWorkoutPlanFull(int? workoutId) => - (super.noSuchMethod(Invocation.method(#fetchAndSetWorkoutPlanFull, [workoutId]), + (super.noSuchMethod( + Invocation.method(#fetchAndSetWorkoutPlanFull, [workoutId]), returnValue: Future<_i6.WorkoutPlan>.value(_FakeWorkoutPlan_4())) as _i13.Future<_i6.WorkoutPlan>); @override @@ -139,78 +146,89 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i12.WorkoutPlansProv @override _i13.Future editWorkout(_i6.WorkoutPlan? workout) => (super.noSuchMethod(Invocation.method(#editWorkout, [workout]), - returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i13.Future); + returnValue: Future.value(), + returnValueForMissingStub: Future.value()) + as _i13.Future); @override - _i13.Future deleteWorkout(int? id) => - (super.noSuchMethod(Invocation.method(#deleteWorkout, [id]), - returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i13.Future); + _i13.Future deleteWorkout(int? id) => (super.noSuchMethod( + Invocation.method(#deleteWorkout, [id]), + returnValue: Future.value(), + returnValueForMissingStub: Future.value()) as _i13.Future); @override _i13.Future> fetchLogData( _i6.WorkoutPlan? workout, _i14.Exercise? exercise) => (super.noSuchMethod(Invocation.method(#fetchLogData, [workout, exercise]), - returnValue: Future>.value({})) + returnValue: + Future>.value({})) as _i13.Future>); @override - _i13.Future fetchAndSetRepetitionUnits() => - (super.noSuchMethod(Invocation.method(#fetchAndSetRepetitionUnits, []), - returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i13.Future); - @override - _i13.Future fetchAndSetWeightUnits() => - (super.noSuchMethod(Invocation.method(#fetchAndSetWeightUnits, []), - returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i13.Future); - @override - _i13.Future fetchAndSetUnits() => - (super.noSuchMethod(Invocation.method(#fetchAndSetUnits, []), - returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i13.Future); - @override - _i13.Future<_i7.Day> addDay(_i7.Day? day, _i6.WorkoutPlan? workout) => - (super.noSuchMethod(Invocation.method(#addDay, [day, workout]), - returnValue: Future<_i7.Day>.value(_FakeDay_5())) as _i13.Future<_i7.Day>); - @override - _i13.Future editDay(_i7.Day? day) => (super.noSuchMethod(Invocation.method(#editDay, [day]), + _i13.Future fetchAndSetRepetitionUnits() => (super.noSuchMethod( + Invocation.method(#fetchAndSetRepetitionUnits, []), returnValue: Future.value(), returnValueForMissingStub: Future.value()) as _i13.Future); @override - _i13.Future deleteDay(_i7.Day? day) => - (super.noSuchMethod(Invocation.method(#deleteDay, [day]), - returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i13.Future); + _i13.Future fetchAndSetWeightUnits() => (super.noSuchMethod( + Invocation.method(#fetchAndSetWeightUnits, []), + returnValue: Future.value(), + returnValueForMissingStub: Future.value()) as _i13.Future); + @override + _i13.Future fetchAndSetUnits() => (super.noSuchMethod( + Invocation.method(#fetchAndSetUnits, []), + returnValue: Future.value(), + returnValueForMissingStub: Future.value()) as _i13.Future); + @override + _i13.Future<_i7.Day> addDay(_i7.Day? day, _i6.WorkoutPlan? workout) => + (super.noSuchMethod(Invocation.method(#addDay, [day, workout]), + returnValue: Future<_i7.Day>.value(_FakeDay_5())) + as _i13.Future<_i7.Day>); + @override + _i13.Future editDay(_i7.Day? day) => (super.noSuchMethod( + Invocation.method(#editDay, [day]), + returnValue: Future.value(), + returnValueForMissingStub: Future.value()) as _i13.Future); + @override + _i13.Future deleteDay(_i7.Day? day) => (super.noSuchMethod( + Invocation.method(#deleteDay, [day]), + returnValue: Future.value(), + returnValueForMissingStub: Future.value()) as _i13.Future); @override _i13.Future<_i8.Set> addSet(_i8.Set? workoutSet) => (super.noSuchMethod(Invocation.method(#addSet, [workoutSet]), - returnValue: Future<_i8.Set>.value(_FakeSet_6())) as _i13.Future<_i8.Set>); + returnValue: Future<_i8.Set>.value(_FakeSet_6())) + as _i13.Future<_i8.Set>); @override - _i13.Future editSet(_i8.Set? workoutSet) => - (super.noSuchMethod(Invocation.method(#editSet, [workoutSet]), - returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i13.Future); + _i13.Future editSet(_i8.Set? workoutSet) => (super.noSuchMethod( + Invocation.method(#editSet, [workoutSet]), + returnValue: Future.value(), + returnValueForMissingStub: Future.value()) as _i13.Future); @override - _i13.Future> reorderSets(List<_i8.Set>? sets, int? startIndex) => + _i13.Future> reorderSets( + List<_i8.Set>? sets, int? startIndex) => (super.noSuchMethod(Invocation.method(#reorderSets, [sets, startIndex]), - returnValue: Future>.value(<_i8.Set>[])) as _i13.Future>); + returnValue: Future>.value(<_i8.Set>[])) + as _i13.Future>); @override - _i13.Future fetchComputedSettings(_i8.Set? workoutSet) => - (super.noSuchMethod(Invocation.method(#fetchComputedSettings, [workoutSet]), - returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i13.Future); + _i13.Future fetchComputedSettings(_i8.Set? workoutSet) => (super + .noSuchMethod(Invocation.method(#fetchComputedSettings, [workoutSet]), + returnValue: Future.value(), + returnValueForMissingStub: Future.value()) + as _i13.Future); @override - _i13.Future fetchSmartText(_i8.Set? workoutSet, _i14.Exercise? exercise) => - (super.noSuchMethod(Invocation.method(#fetchSmartText, [workoutSet, exercise]), + _i13.Future fetchSmartText( + _i8.Set? workoutSet, _i14.Exercise? exercise) => + (super.noSuchMethod( + Invocation.method(#fetchSmartText, [workoutSet, exercise]), returnValue: Future.value('')) as _i13.Future); @override - _i13.Future deleteSet(_i8.Set? workoutSet) => - (super.noSuchMethod(Invocation.method(#deleteSet, [workoutSet]), - returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i13.Future); + _i13.Future deleteSet(_i8.Set? workoutSet) => (super.noSuchMethod( + Invocation.method(#deleteSet, [workoutSet]), + returnValue: Future.value(), + returnValueForMissingStub: Future.value()) as _i13.Future); @override _i13.Future<_i9.Setting> addSetting(_i9.Setting? workoutSetting) => (super.noSuchMethod(Invocation.method(#addSetting, [workoutSetting]), - returnValue: Future<_i9.Setting>.value(_FakeSetting_7())) as _i13.Future<_i9.Setting>); + returnValue: Future<_i9.Setting>.value(_FakeSetting_7())) + as _i13.Future<_i9.Setting>); @override _i13.Future fetchSessionData() => (super.noSuchMethod(Invocation.method(#fetchSessionData, []), @@ -218,55 +236,65 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i12.WorkoutPlansProv @override _i13.Future<_i10.WorkoutSession> addSession(_i10.WorkoutSession? session) => (super.noSuchMethod(Invocation.method(#addSession, [session]), - returnValue: Future<_i10.WorkoutSession>.value(_FakeWorkoutSession_8())) + returnValue: + Future<_i10.WorkoutSession>.value(_FakeWorkoutSession_8())) as _i13.Future<_i10.WorkoutSession>); @override _i13.Future<_i11.Log> addLog(_i11.Log? log) => (super.noSuchMethod(Invocation.method(#addLog, [log]), - returnValue: Future<_i11.Log>.value(_FakeLog_9())) as _i13.Future<_i11.Log>); + returnValue: Future<_i11.Log>.value(_FakeLog_9())) + as _i13.Future<_i11.Log>); @override - _i13.Future deleteLog(_i11.Log? log) => - (super.noSuchMethod(Invocation.method(#deleteLog, [log]), - returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i13.Future); + _i13.Future deleteLog(_i11.Log? log) => (super.noSuchMethod( + Invocation.method(#deleteLog, [log]), + returnValue: Future.value(), + returnValueForMissingStub: Future.value()) as _i13.Future); @override - Uri makeUrl(String? path, {int? id, String? objectMethod, Map? query}) => + Uri makeUrl(String? path, + {int? id, String? objectMethod, Map? query}) => (super.noSuchMethod( - Invocation.method( - #makeUrl, [path], {#id: id, #objectMethod: objectMethod, #query: query}), + Invocation.method(#makeUrl, [path], + {#id: id, #objectMethod: objectMethod, #query: query}), returnValue: _FakeUri_10()) as Uri); @override - _i13.Future> fetch(Uri? uri) => - (super.noSuchMethod(Invocation.method(#fetch, [uri]), - returnValue: Future>.value({})) - as _i13.Future>); + _i13.Future> fetch(Uri? uri) => (super.noSuchMethod( + Invocation.method(#fetch, [uri]), + returnValue: Future>.value({})) + as _i13.Future>); @override - _i13.Future> post(Map? data, Uri? uri) => + _i13.Future> post( + Map? data, Uri? uri) => (super.noSuchMethod(Invocation.method(#post, [data, uri]), - returnValue: Future>.value({})) + returnValue: + Future>.value({})) as _i13.Future>); @override - _i13.Future> patch(Map? data, Uri? uri) => + _i13.Future> patch( + Map? data, Uri? uri) => (super.noSuchMethod(Invocation.method(#patch, [data, uri]), - returnValue: Future>.value({})) + returnValue: + Future>.value({})) as _i13.Future>); @override - _i13.Future<_i5.Response> deleteRequest(String? url, int? id) => (super.noSuchMethod( - Invocation.method(#deleteRequest, [url, id]), - returnValue: Future<_i5.Response>.value(_FakeResponse_11())) as _i13.Future<_i5.Response>); + _i13.Future<_i5.Response> deleteRequest(String? url, int? id) => + (super.noSuchMethod(Invocation.method(#deleteRequest, [url, id]), + returnValue: Future<_i5.Response>.value(_FakeResponse_11())) + as _i13.Future<_i5.Response>); @override String toString() => super.toString(); @override - void addListener(_i15.VoidCallback? listener) => super - .noSuchMethod(Invocation.method(#addListener, [listener]), returnValueForMissingStub: null); + void addListener(_i15.VoidCallback? listener) => + super.noSuchMethod(Invocation.method(#addListener, [listener]), + returnValueForMissingStub: null); @override void removeListener(_i15.VoidCallback? listener) => super.noSuchMethod(Invocation.method(#removeListener, [listener]), returnValueForMissingStub: null); @override - void dispose() => - super.noSuchMethod(Invocation.method(#dispose, []), returnValueForMissingStub: null); + void dispose() => super.noSuchMethod(Invocation.method(#dispose, []), + returnValueForMissingStub: null); @override void notifyListeners() => - super.noSuchMethod(Invocation.method(#notifyListeners, []), returnValueForMissingStub: null); + super.noSuchMethod(Invocation.method(#notifyListeners, []), + returnValueForMissingStub: null); } diff --git a/test/workout_set_form_test.mocks.dart b/test/workout_set_form_test.mocks.dart index b6cef929..704eecf4 100644 --- a/test/workout_set_form_test.mocks.dart +++ b/test/workout_set_form_test.mocks.dart @@ -38,29 +38,30 @@ class MockExercisesProvider extends _i1.Mock implements _i5.ExercisesProvider { } @override - List<_i4.Exercise> get items => - (super.noSuchMethod(Invocation.getter(#items), returnValue: <_i4.Exercise>[]) - as List<_i4.Exercise>); + List<_i4.Exercise> get items => (super.noSuchMethod(Invocation.getter(#items), + returnValue: <_i4.Exercise>[]) as List<_i4.Exercise>); @override - _i2.AuthProvider get auth => - (super.noSuchMethod(Invocation.getter(#auth), returnValue: _FakeAuthProvider_0()) - as _i2.AuthProvider); + _i2.AuthProvider get auth => (super.noSuchMethod(Invocation.getter(#auth), + returnValue: _FakeAuthProvider_0()) as _i2.AuthProvider); @override set auth(_i2.AuthProvider? _auth) => - super.noSuchMethod(Invocation.setter(#auth, _auth), returnValueForMissingStub: null); + super.noSuchMethod(Invocation.setter(#auth, _auth), + returnValueForMissingStub: null); @override - _i3.Client get client => - (super.noSuchMethod(Invocation.getter(#client), returnValue: _FakeClient_1()) as _i3.Client); + _i3.Client get client => (super.noSuchMethod(Invocation.getter(#client), + returnValue: _FakeClient_1()) as _i3.Client); @override set client(_i3.Client? _client) => - super.noSuchMethod(Invocation.setter(#client, _client), returnValueForMissingStub: null); + super.noSuchMethod(Invocation.setter(#client, _client), + returnValueForMissingStub: null); @override bool get hasListeners => - (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) as bool); + (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) + as bool); @override - _i4.Exercise findById(int? exerciseId) => (super - .noSuchMethod(Invocation.method(#findById, [exerciseId]), returnValue: _FakeExercise_2()) - as _i4.Exercise); + _i4.Exercise findById(int? exerciseId) => + (super.noSuchMethod(Invocation.method(#findById, [exerciseId]), + returnValue: _FakeExercise_2()) as _i4.Exercise); @override _i6.Future fetchAndSetCategories() => (super.noSuchMethod(Invocation.method(#fetchAndSetCategories, []), @@ -79,54 +80,65 @@ class MockExercisesProvider extends _i1.Mock implements _i5.ExercisesProvider { @override _i6.Future<_i4.Exercise> fetchAndSetExercise(int? exerciseId) => (super.noSuchMethod(Invocation.method(#fetchAndSetExercise, [exerciseId]), - returnValue: Future<_i4.Exercise>.value(_FakeExercise_2())) as _i6.Future<_i4.Exercise>); + returnValue: Future<_i4.Exercise>.value(_FakeExercise_2())) + as _i6.Future<_i4.Exercise>); @override _i6.Future fetchAndSetExercises() => (super.noSuchMethod(Invocation.method(#fetchAndSetExercises, []), returnValue: Future.value(), returnValueForMissingStub: Future.value()) as _i6.Future); @override - _i6.Future> searchExercise(String? name, [String? languageCode = r'en']) => - (super.noSuchMethod(Invocation.method(#searchExercise, [name, languageCode]), - returnValue: Future>.value([])) as _i6.Future>); - @override - Uri makeUrl(String? path, {int? id, String? objectMethod, Map? query}) => + _i6.Future> searchExercise(String? name, + [String? languageCode = r'en']) => (super.noSuchMethod( - Invocation.method( - #makeUrl, [path], {#id: id, #objectMethod: objectMethod, #query: query}), + Invocation.method(#searchExercise, [name, languageCode]), + returnValue: Future>.value([])) + as _i6.Future>); + @override + Uri makeUrl(String? path, + {int? id, String? objectMethod, Map? query}) => + (super.noSuchMethod( + Invocation.method(#makeUrl, [path], + {#id: id, #objectMethod: objectMethod, #query: query}), returnValue: _FakeUri_3()) as Uri); @override - _i6.Future> fetch(Uri? uri) => - (super.noSuchMethod(Invocation.method(#fetch, [uri]), - returnValue: Future>.value({})) - as _i6.Future>); + _i6.Future> fetch(Uri? uri) => (super.noSuchMethod( + Invocation.method(#fetch, [uri]), + returnValue: Future>.value({})) + as _i6.Future>); @override _i6.Future> post(Map? data, Uri? uri) => (super.noSuchMethod(Invocation.method(#post, [data, uri]), - returnValue: Future>.value({})) + returnValue: + Future>.value({})) as _i6.Future>); @override - _i6.Future> patch(Map? data, Uri? uri) => + _i6.Future> patch( + Map? data, Uri? uri) => (super.noSuchMethod(Invocation.method(#patch, [data, uri]), - returnValue: Future>.value({})) + returnValue: + Future>.value({})) as _i6.Future>); @override _i6.Future<_i3.Response> deleteRequest(String? url, int? id) => (super.noSuchMethod(Invocation.method(#deleteRequest, [url, id]), - returnValue: Future<_i3.Response>.value(_FakeResponse_4())) as _i6.Future<_i3.Response>); + returnValue: Future<_i3.Response>.value(_FakeResponse_4())) + as _i6.Future<_i3.Response>); @override String toString() => super.toString(); @override - void addListener(_i7.VoidCallback? listener) => super - .noSuchMethod(Invocation.method(#addListener, [listener]), returnValueForMissingStub: null); + void addListener(_i7.VoidCallback? listener) => + super.noSuchMethod(Invocation.method(#addListener, [listener]), + returnValueForMissingStub: null); @override void removeListener(_i7.VoidCallback? listener) => super.noSuchMethod(Invocation.method(#removeListener, [listener]), returnValueForMissingStub: null); @override - void dispose() => - super.noSuchMethod(Invocation.method(#dispose, []), returnValueForMissingStub: null); + void dispose() => super.noSuchMethod(Invocation.method(#dispose, []), + returnValueForMissingStub: null); @override void notifyListeners() => - super.noSuchMethod(Invocation.method(#notifyListeners, []), returnValueForMissingStub: null); + super.noSuchMethod(Invocation.method(#notifyListeners, []), + returnValueForMissingStub: null); } From e23937981da2ad752468225e495a51c55755b664 Mon Sep 17 00:00:00 2001 From: Github-actions Date: Thu, 28 Oct 2021 09:47:48 +0000 Subject: [PATCH 21/40] Automatic linting --- pubspec.lock | 10 +- test/gallery_screen_test.mocks.dart | 69 +++--- ...surement_categories_screen_test.mocks.dart | 59 ++--- test/nutritional_plan_form_test.mocks.dart | 109 ++++---- test/workout_form_test.mocks.dart | 232 ++++++++---------- test/workout_set_form_test.mocks.dart | 80 +++--- 6 files changed, 240 insertions(+), 319 deletions(-) diff --git a/pubspec.lock b/pubspec.lock index ed2de5b6..f333a21c 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -14,7 +14,7 @@ packages: name: analyzer url: "https://pub.dartlang.org" source: hosted - version: "1.7.1" + version: "1.7.2" android_metadata: dependency: "direct main" description: @@ -42,7 +42,7 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.6.1" + version: "2.8.1" boolean_selector: dependency: transitive description: @@ -133,7 +133,7 @@ packages: name: charcode url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "1.3.1" charts_common: dependency: transitive description: @@ -524,7 +524,7 @@ packages: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.3.0" + version: "1.7.0" mime: dependency: transitive description: @@ -823,7 +823,7 @@ packages: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.3.0" + version: "0.4.2" timing: dependency: transitive description: diff --git a/test/gallery_screen_test.mocks.dart b/test/gallery_screen_test.mocks.dart index 973b4ce7..b7864a90 100644 --- a/test/gallery_screen_test.mocks.dart +++ b/test/gallery_screen_test.mocks.dart @@ -37,33 +37,31 @@ class MockGalleryProvider extends _i1.Mock implements _i4.GalleryProvider { } @override - List<_i5.Image> get images => (super.noSuchMethod(Invocation.getter(#images), - returnValue: <_i5.Image>[]) as List<_i5.Image>); + List<_i5.Image> get images => + (super.noSuchMethod(Invocation.getter(#images), returnValue: <_i5.Image>[]) + as List<_i5.Image>); @override set images(List<_i5.Image>? _images) => - super.noSuchMethod(Invocation.setter(#images, _images), - returnValueForMissingStub: null); + super.noSuchMethod(Invocation.setter(#images, _images), returnValueForMissingStub: null); @override - _i2.AuthProvider get auth => (super.noSuchMethod(Invocation.getter(#auth), - returnValue: _FakeAuthProvider_0()) as _i2.AuthProvider); + _i2.AuthProvider get auth => + (super.noSuchMethod(Invocation.getter(#auth), returnValue: _FakeAuthProvider_0()) + as _i2.AuthProvider); @override set auth(_i2.AuthProvider? _auth) => - super.noSuchMethod(Invocation.setter(#auth, _auth), - returnValueForMissingStub: null); + super.noSuchMethod(Invocation.setter(#auth, _auth), returnValueForMissingStub: null); @override - _i3.Client get client => (super.noSuchMethod(Invocation.getter(#client), - returnValue: _FakeClient_1()) as _i3.Client); + _i3.Client get client => + (super.noSuchMethod(Invocation.getter(#client), returnValue: _FakeClient_1()) as _i3.Client); @override set client(_i3.Client? _client) => - super.noSuchMethod(Invocation.setter(#client, _client), - returnValueForMissingStub: null); + super.noSuchMethod(Invocation.setter(#client, _client), returnValueForMissingStub: null); @override bool get hasListeners => - (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) - as bool); + (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) as bool); @override - void clear() => super.noSuchMethod(Invocation.method(#clear, []), - returnValueForMissingStub: null); + void clear() => + super.noSuchMethod(Invocation.method(#clear, []), returnValueForMissingStub: null); @override _i6.Future fetchAndSetGallery() => (super.noSuchMethod(Invocation.method(#fetchAndSetGallery, []), @@ -85,50 +83,43 @@ class MockGalleryProvider extends _i1.Mock implements _i4.GalleryProvider { returnValue: Future.value(), returnValueForMissingStub: Future.value()) as _i6.Future); @override - Uri makeUrl(String? path, - {int? id, String? objectMethod, Map? query}) => + Uri makeUrl(String? path, {int? id, String? objectMethod, Map? query}) => (super.noSuchMethod( - Invocation.method(#makeUrl, [path], - {#id: id, #objectMethod: objectMethod, #query: query}), + Invocation.method( + #makeUrl, [path], {#id: id, #objectMethod: objectMethod, #query: query}), returnValue: _FakeUri_2()) as Uri); @override - _i6.Future> fetch(Uri? uri) => (super.noSuchMethod( - Invocation.method(#fetch, [uri]), - returnValue: Future>.value({})) - as _i6.Future>); + _i6.Future> fetch(Uri? uri) => + (super.noSuchMethod(Invocation.method(#fetch, [uri]), + returnValue: Future>.value({})) + as _i6.Future>); @override _i6.Future> post(Map? data, Uri? uri) => (super.noSuchMethod(Invocation.method(#post, [data, uri]), - returnValue: - Future>.value({})) + returnValue: Future>.value({})) as _i6.Future>); @override - _i6.Future> patch( - Map? data, Uri? uri) => + _i6.Future> patch(Map? data, Uri? uri) => (super.noSuchMethod(Invocation.method(#patch, [data, uri]), - returnValue: - Future>.value({})) + returnValue: Future>.value({})) as _i6.Future>); @override _i6.Future<_i3.Response> deleteRequest(String? url, int? id) => (super.noSuchMethod(Invocation.method(#deleteRequest, [url, id]), - returnValue: Future<_i3.Response>.value(_FakeResponse_3())) - as _i6.Future<_i3.Response>); + returnValue: Future<_i3.Response>.value(_FakeResponse_3())) as _i6.Future<_i3.Response>); @override String toString() => super.toString(); @override - void addListener(_i8.VoidCallback? listener) => - super.noSuchMethod(Invocation.method(#addListener, [listener]), - returnValueForMissingStub: null); + void addListener(_i8.VoidCallback? listener) => super + .noSuchMethod(Invocation.method(#addListener, [listener]), returnValueForMissingStub: null); @override void removeListener(_i8.VoidCallback? listener) => super.noSuchMethod(Invocation.method(#removeListener, [listener]), returnValueForMissingStub: null); @override - void dispose() => super.noSuchMethod(Invocation.method(#dispose, []), - returnValueForMissingStub: null); + void dispose() => + super.noSuchMethod(Invocation.method(#dispose, []), returnValueForMissingStub: null); @override void notifyListeners() => - super.noSuchMethod(Invocation.method(#notifyListeners, []), - returnValueForMissingStub: null); + super.noSuchMethod(Invocation.method(#notifyListeners, []), returnValueForMissingStub: null); } diff --git a/test/measurements/measurement_categories_screen_test.mocks.dart b/test/measurements/measurement_categories_screen_test.mocks.dart index f3b33bb4..bc5f90a5 100644 --- a/test/measurements/measurement_categories_screen_test.mocks.dart +++ b/test/measurements/measurement_categories_screen_test.mocks.dart @@ -19,41 +19,36 @@ import 'package:wger/providers/measurement.dart' as _i4; // ignore_for_file: prefer_const_constructors // ignore_for_file: unnecessary_parenthesis -class _FakeWgerBaseProvider_0 extends _i1.Fake implements _i2.WgerBaseProvider { -} +class _FakeWgerBaseProvider_0 extends _i1.Fake implements _i2.WgerBaseProvider {} -class _FakeMeasurementCategory_1 extends _i1.Fake - implements _i3.MeasurementCategory {} +class _FakeMeasurementCategory_1 extends _i1.Fake implements _i3.MeasurementCategory {} /// A class which mocks [MeasurementProvider]. /// /// See the documentation for Mockito's code generation for more information. -class MockMeasurementProvider extends _i1.Mock - implements _i4.MeasurementProvider { +class MockMeasurementProvider extends _i1.Mock implements _i4.MeasurementProvider { MockMeasurementProvider() { _i1.throwOnMissingStub(this); } @override _i2.WgerBaseProvider get baseProvider => - (super.noSuchMethod(Invocation.getter(#baseProvider), - returnValue: _FakeWgerBaseProvider_0()) as _i2.WgerBaseProvider); + (super.noSuchMethod(Invocation.getter(#baseProvider), returnValue: _FakeWgerBaseProvider_0()) + as _i2.WgerBaseProvider); @override List<_i3.MeasurementCategory> get categories => - (super.noSuchMethod(Invocation.getter(#categories), - returnValue: <_i3.MeasurementCategory>[]) + (super.noSuchMethod(Invocation.getter(#categories), returnValue: <_i3.MeasurementCategory>[]) as List<_i3.MeasurementCategory>); @override bool get hasListeners => - (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) - as bool); + (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) as bool); @override - void clear() => super.noSuchMethod(Invocation.method(#clear, []), - returnValueForMissingStub: null); + void clear() => + super.noSuchMethod(Invocation.method(#clear, []), returnValueForMissingStub: null); @override - _i3.MeasurementCategory findCategoryById(int? id) => (super.noSuchMethod( - Invocation.method(#findCategoryById, [id]), - returnValue: _FakeMeasurementCategory_1()) as _i3.MeasurementCategory); + _i3.MeasurementCategory findCategoryById(int? id) => + (super.noSuchMethod(Invocation.method(#findCategoryById, [id]), + returnValue: _FakeMeasurementCategory_1()) as _i3.MeasurementCategory); @override _i5.Future fetchAndSetCategories() => (super.noSuchMethod(Invocation.method(#fetchAndSetCategories, []), @@ -65,10 +60,10 @@ class MockMeasurementProvider extends _i1.Mock returnValue: Future.value(), returnValueForMissingStub: Future.value()) as _i5.Future); @override - _i5.Future fetchAndSetAllCategoriesAndEntries() => (super.noSuchMethod( - Invocation.method(#fetchAndSetAllCategoriesAndEntries, []), - returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i5.Future); + _i5.Future fetchAndSetAllCategoriesAndEntries() => + (super.noSuchMethod(Invocation.method(#fetchAndSetAllCategoriesAndEntries, []), + returnValue: Future.value(), + returnValueForMissingStub: Future.value()) as _i5.Future); @override _i5.Future addCategory(_i3.MeasurementCategory? category) => (super.noSuchMethod(Invocation.method(#addCategory, [category]), @@ -81,8 +76,7 @@ class MockMeasurementProvider extends _i1.Mock returnValueForMissingStub: Future.value()) as _i5.Future); @override _i5.Future editCategory(int? id, String? newName, String? newUnit) => - (super.noSuchMethod( - Invocation.method(#editCategory, [id, newName, newUnit]), + (super.noSuchMethod(Invocation.method(#editCategory, [id, newName, newUnit]), returnValue: Future.value(), returnValueForMissingStub: Future.value()) as _i5.Future); @override @@ -96,28 +90,25 @@ class MockMeasurementProvider extends _i1.Mock returnValue: Future.value(), returnValueForMissingStub: Future.value()) as _i5.Future); @override - _i5.Future editEntry(int? id, int? categoryId, num? newValue, - String? newNotes, DateTime? newDate) => + _i5.Future editEntry( + int? id, int? categoryId, num? newValue, String? newNotes, DateTime? newDate) => (super.noSuchMethod( - Invocation.method( - #editEntry, [id, categoryId, newValue, newNotes, newDate]), + Invocation.method(#editEntry, [id, categoryId, newValue, newNotes, newDate]), returnValue: Future.value(), returnValueForMissingStub: Future.value()) as _i5.Future); @override String toString() => super.toString(); @override - void addListener(_i7.VoidCallback? listener) => - super.noSuchMethod(Invocation.method(#addListener, [listener]), - returnValueForMissingStub: null); + void addListener(_i7.VoidCallback? listener) => super + .noSuchMethod(Invocation.method(#addListener, [listener]), returnValueForMissingStub: null); @override void removeListener(_i7.VoidCallback? listener) => super.noSuchMethod(Invocation.method(#removeListener, [listener]), returnValueForMissingStub: null); @override - void dispose() => super.noSuchMethod(Invocation.method(#dispose, []), - returnValueForMissingStub: null); + void dispose() => + super.noSuchMethod(Invocation.method(#dispose, []), returnValueForMissingStub: null); @override void notifyListeners() => - super.noSuchMethod(Invocation.method(#notifyListeners, []), - returnValueForMissingStub: null); + super.noSuchMethod(Invocation.method(#notifyListeners, []), returnValueForMissingStub: null); } diff --git a/test/nutritional_plan_form_test.mocks.dart b/test/nutritional_plan_form_test.mocks.dart index ec5bfd5f..a878141a 100644 --- a/test/nutritional_plan_form_test.mocks.dart +++ b/test/nutritional_plan_form_test.mocks.dart @@ -41,41 +41,38 @@ class _FakeResponse_7 extends _i1.Fake implements _i3.Response {} /// A class which mocks [NutritionPlansProvider]. /// /// See the documentation for Mockito's code generation for more information. -class MockNutritionPlansProvider extends _i1.Mock - implements _i8.NutritionPlansProvider { +class MockNutritionPlansProvider extends _i1.Mock implements _i8.NutritionPlansProvider { MockNutritionPlansProvider() { _i1.throwOnMissingStub(this); } @override List<_i4.NutritionalPlan> get items => - (super.noSuchMethod(Invocation.getter(#items), - returnValue: <_i4.NutritionalPlan>[]) as List<_i4.NutritionalPlan>); + (super.noSuchMethod(Invocation.getter(#items), returnValue: <_i4.NutritionalPlan>[]) + as List<_i4.NutritionalPlan>); @override - _i2.AuthProvider get auth => (super.noSuchMethod(Invocation.getter(#auth), - returnValue: _FakeAuthProvider_0()) as _i2.AuthProvider); + _i2.AuthProvider get auth => + (super.noSuchMethod(Invocation.getter(#auth), returnValue: _FakeAuthProvider_0()) + as _i2.AuthProvider); @override set auth(_i2.AuthProvider? _auth) => - super.noSuchMethod(Invocation.setter(#auth, _auth), - returnValueForMissingStub: null); + super.noSuchMethod(Invocation.setter(#auth, _auth), returnValueForMissingStub: null); @override - _i3.Client get client => (super.noSuchMethod(Invocation.getter(#client), - returnValue: _FakeClient_1()) as _i3.Client); + _i3.Client get client => + (super.noSuchMethod(Invocation.getter(#client), returnValue: _FakeClient_1()) as _i3.Client); @override set client(_i3.Client? _client) => - super.noSuchMethod(Invocation.setter(#client, _client), - returnValueForMissingStub: null); + super.noSuchMethod(Invocation.setter(#client, _client), returnValueForMissingStub: null); @override bool get hasListeners => - (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) - as bool); + (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) as bool); @override - void clear() => super.noSuchMethod(Invocation.method(#clear, []), - returnValueForMissingStub: null); + void clear() => + super.noSuchMethod(Invocation.method(#clear, []), returnValueForMissingStub: null); @override _i4.NutritionalPlan findById(int? id) => - (super.noSuchMethod(Invocation.method(#findById, [id]), - returnValue: _FakeNutritionalPlan_2()) as _i4.NutritionalPlan); + (super.noSuchMethod(Invocation.method(#findById, [id]), returnValue: _FakeNutritionalPlan_2()) + as _i4.NutritionalPlan); @override _i5.Meal? findMealById(int? id) => (super.noSuchMethod(Invocation.method(#findMealById, [id])) as _i5.Meal?); @@ -92,20 +89,17 @@ class MockNutritionPlansProvider extends _i1.Mock @override _i9.Future<_i4.NutritionalPlan> fetchAndSetPlanSparse(int? planId) => (super.noSuchMethod(Invocation.method(#fetchAndSetPlanSparse, [planId]), - returnValue: - Future<_i4.NutritionalPlan>.value(_FakeNutritionalPlan_2())) + returnValue: Future<_i4.NutritionalPlan>.value(_FakeNutritionalPlan_2())) as _i9.Future<_i4.NutritionalPlan>); @override _i9.Future<_i4.NutritionalPlan> fetchAndSetPlanFull(int? planId) => (super.noSuchMethod(Invocation.method(#fetchAndSetPlanFull, [planId]), - returnValue: - Future<_i4.NutritionalPlan>.value(_FakeNutritionalPlan_2())) + returnValue: Future<_i4.NutritionalPlan>.value(_FakeNutritionalPlan_2())) as _i9.Future<_i4.NutritionalPlan>); @override _i9.Future<_i4.NutritionalPlan> addPlan(_i4.NutritionalPlan? planData) => (super.noSuchMethod(Invocation.method(#addPlan, [planData]), - returnValue: - Future<_i4.NutritionalPlan>.value(_FakeNutritionalPlan_2())) + returnValue: Future<_i4.NutritionalPlan>.value(_FakeNutritionalPlan_2())) as _i9.Future<_i4.NutritionalPlan>); @override _i9.Future editPlan(_i4.NutritionalPlan? plan) => @@ -113,31 +107,26 @@ class MockNutritionPlansProvider extends _i1.Mock returnValue: Future.value(), returnValueForMissingStub: Future.value()) as _i9.Future); @override - _i9.Future deletePlan(int? id) => - (super.noSuchMethod(Invocation.method(#deletePlan, [id]), - returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i9.Future); + _i9.Future deletePlan(int? id) => (super.noSuchMethod(Invocation.method(#deletePlan, [id]), + returnValue: Future.value(), + returnValueForMissingStub: Future.value()) as _i9.Future); @override _i9.Future<_i5.Meal> addMeal(_i5.Meal? meal, int? planId) => (super.noSuchMethod(Invocation.method(#addMeal, [meal, planId]), - returnValue: Future<_i5.Meal>.value(_FakeMeal_3())) - as _i9.Future<_i5.Meal>); + returnValue: Future<_i5.Meal>.value(_FakeMeal_3())) as _i9.Future<_i5.Meal>); @override _i9.Future<_i5.Meal> editMeal(_i5.Meal? meal) => (super.noSuchMethod(Invocation.method(#editMeal, [meal]), - returnValue: Future<_i5.Meal>.value(_FakeMeal_3())) - as _i9.Future<_i5.Meal>); + returnValue: Future<_i5.Meal>.value(_FakeMeal_3())) as _i9.Future<_i5.Meal>); @override _i9.Future deleteMeal(_i5.Meal? meal) => (super.noSuchMethod(Invocation.method(#deleteMeal, [meal]), returnValue: Future.value(), returnValueForMissingStub: Future.value()) as _i9.Future); @override - _i9.Future<_i6.MealItem> addMealItem( - _i6.MealItem? mealItem, _i5.Meal? meal) => + _i9.Future<_i6.MealItem> addMealItem(_i6.MealItem? mealItem, _i5.Meal? meal) => (super.noSuchMethod(Invocation.method(#addMealItem, [mealItem, meal]), - returnValue: Future<_i6.MealItem>.value(_FakeMealItem_4())) - as _i9.Future<_i6.MealItem>); + returnValue: Future<_i6.MealItem>.value(_FakeMealItem_4())) as _i9.Future<_i6.MealItem>); @override _i9.Future deleteMealItem(_i6.MealItem? mealItem) => (super.noSuchMethod(Invocation.method(#deleteMealItem, [mealItem]), @@ -154,12 +143,9 @@ class MockNutritionPlansProvider extends _i1.Mock returnValue: Future.value(), returnValueForMissingStub: Future.value()) as _i9.Future); @override - _i9.Future> searchIngredient(String? name, - [String? languageCode = r'en']) => - (super.noSuchMethod( - Invocation.method(#searchIngredient, [name, languageCode]), - returnValue: Future>.value([])) - as _i9.Future>); + _i9.Future> searchIngredient(String? name, [String? languageCode = r'en']) => + (super.noSuchMethod(Invocation.method(#searchIngredient, [name, languageCode]), + returnValue: Future>.value([])) as _i9.Future>); @override _i9.Future logMealToDiary(_i5.Meal? meal) => (super.noSuchMethod(Invocation.method(#logMealToDiary, [meal]), @@ -176,50 +162,43 @@ class MockNutritionPlansProvider extends _i1.Mock returnValue: Future.value(), returnValueForMissingStub: Future.value()) as _i9.Future); @override - Uri makeUrl(String? path, - {int? id, String? objectMethod, Map? query}) => + Uri makeUrl(String? path, {int? id, String? objectMethod, Map? query}) => (super.noSuchMethod( - Invocation.method(#makeUrl, [path], - {#id: id, #objectMethod: objectMethod, #query: query}), + Invocation.method( + #makeUrl, [path], {#id: id, #objectMethod: objectMethod, #query: query}), returnValue: _FakeUri_6()) as Uri); @override - _i9.Future> fetch(Uri? uri) => (super.noSuchMethod( - Invocation.method(#fetch, [uri]), - returnValue: Future>.value({})) - as _i9.Future>); + _i9.Future> fetch(Uri? uri) => + (super.noSuchMethod(Invocation.method(#fetch, [uri]), + returnValue: Future>.value({})) + as _i9.Future>); @override _i9.Future> post(Map? data, Uri? uri) => (super.noSuchMethod(Invocation.method(#post, [data, uri]), - returnValue: - Future>.value({})) + returnValue: Future>.value({})) as _i9.Future>); @override - _i9.Future> patch( - Map? data, Uri? uri) => + _i9.Future> patch(Map? data, Uri? uri) => (super.noSuchMethod(Invocation.method(#patch, [data, uri]), - returnValue: - Future>.value({})) + returnValue: Future>.value({})) as _i9.Future>); @override _i9.Future<_i3.Response> deleteRequest(String? url, int? id) => (super.noSuchMethod(Invocation.method(#deleteRequest, [url, id]), - returnValue: Future<_i3.Response>.value(_FakeResponse_7())) - as _i9.Future<_i3.Response>); + returnValue: Future<_i3.Response>.value(_FakeResponse_7())) as _i9.Future<_i3.Response>); @override String toString() => super.toString(); @override - void addListener(_i10.VoidCallback? listener) => - super.noSuchMethod(Invocation.method(#addListener, [listener]), - returnValueForMissingStub: null); + void addListener(_i10.VoidCallback? listener) => super + .noSuchMethod(Invocation.method(#addListener, [listener]), returnValueForMissingStub: null); @override void removeListener(_i10.VoidCallback? listener) => super.noSuchMethod(Invocation.method(#removeListener, [listener]), returnValueForMissingStub: null); @override - void dispose() => super.noSuchMethod(Invocation.method(#dispose, []), - returnValueForMissingStub: null); + void dispose() => + super.noSuchMethod(Invocation.method(#dispose, []), returnValueForMissingStub: null); @override void notifyListeners() => - super.noSuchMethod(Invocation.method(#notifyListeners, []), - returnValueForMissingStub: null); + super.noSuchMethod(Invocation.method(#notifyListeners, []), returnValueForMissingStub: null); } diff --git a/test/workout_form_test.mocks.dart b/test/workout_form_test.mocks.dart index 62ef2499..9bfd1d08 100644 --- a/test/workout_form_test.mocks.dart +++ b/test/workout_form_test.mocks.dart @@ -54,79 +54,73 @@ class _FakeResponse_11 extends _i1.Fake implements _i5.Response {} /// A class which mocks [WorkoutPlansProvider]. /// /// See the documentation for Mockito's code generation for more information. -class MockWorkoutPlansProvider extends _i1.Mock - implements _i12.WorkoutPlansProvider { +class MockWorkoutPlansProvider extends _i1.Mock implements _i12.WorkoutPlansProvider { MockWorkoutPlansProvider() { _i1.throwOnMissingStub(this); } @override List<_i6.WorkoutPlan> get items => - (super.noSuchMethod(Invocation.getter(#items), - returnValue: <_i6.WorkoutPlan>[]) as List<_i6.WorkoutPlan>); + (super.noSuchMethod(Invocation.getter(#items), returnValue: <_i6.WorkoutPlan>[]) + as List<_i6.WorkoutPlan>); @override List<_i2.WeightUnit> get weightUnits => - (super.noSuchMethod(Invocation.getter(#weightUnits), - returnValue: <_i2.WeightUnit>[]) as List<_i2.WeightUnit>); + (super.noSuchMethod(Invocation.getter(#weightUnits), returnValue: <_i2.WeightUnit>[]) + as List<_i2.WeightUnit>); @override _i2.WeightUnit get defaultWeightUnit => - (super.noSuchMethod(Invocation.getter(#defaultWeightUnit), - returnValue: _FakeWeightUnit_0()) as _i2.WeightUnit); + (super.noSuchMethod(Invocation.getter(#defaultWeightUnit), returnValue: _FakeWeightUnit_0()) + as _i2.WeightUnit); @override List<_i3.RepetitionUnit> get repetitionUnits => - (super.noSuchMethod(Invocation.getter(#repetitionUnits), - returnValue: <_i3.RepetitionUnit>[]) as List<_i3.RepetitionUnit>); + (super.noSuchMethod(Invocation.getter(#repetitionUnits), returnValue: <_i3.RepetitionUnit>[]) + as List<_i3.RepetitionUnit>); @override _i3.RepetitionUnit get defaultRepetitionUnit => (super.noSuchMethod(Invocation.getter(#defaultRepetitionUnit), returnValue: _FakeRepetitionUnit_1()) as _i3.RepetitionUnit); @override - _i4.AuthProvider get auth => (super.noSuchMethod(Invocation.getter(#auth), - returnValue: _FakeAuthProvider_2()) as _i4.AuthProvider); + _i4.AuthProvider get auth => + (super.noSuchMethod(Invocation.getter(#auth), returnValue: _FakeAuthProvider_2()) + as _i4.AuthProvider); @override set auth(_i4.AuthProvider? _auth) => - super.noSuchMethod(Invocation.setter(#auth, _auth), - returnValueForMissingStub: null); + super.noSuchMethod(Invocation.setter(#auth, _auth), returnValueForMissingStub: null); @override - _i5.Client get client => (super.noSuchMethod(Invocation.getter(#client), - returnValue: _FakeClient_3()) as _i5.Client); + _i5.Client get client => + (super.noSuchMethod(Invocation.getter(#client), returnValue: _FakeClient_3()) as _i5.Client); @override set client(_i5.Client? _client) => - super.noSuchMethod(Invocation.setter(#client, _client), - returnValueForMissingStub: null); + super.noSuchMethod(Invocation.setter(#client, _client), returnValueForMissingStub: null); @override bool get hasListeners => - (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) - as bool); + (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) as bool); @override - void clear() => super.noSuchMethod(Invocation.method(#clear, []), - returnValueForMissingStub: null); + void clear() => + super.noSuchMethod(Invocation.method(#clear, []), returnValueForMissingStub: null); @override _i6.WorkoutPlan findById(int? id) => - (super.noSuchMethod(Invocation.method(#findById, [id]), - returnValue: _FakeWorkoutPlan_4()) as _i6.WorkoutPlan); + (super.noSuchMethod(Invocation.method(#findById, [id]), returnValue: _FakeWorkoutPlan_4()) + as _i6.WorkoutPlan); @override - int findIndexById(int? id) => (super - .noSuchMethod(Invocation.method(#findIndexById, [id]), returnValue: 0) - as int); + int findIndexById(int? id) => + (super.noSuchMethod(Invocation.method(#findIndexById, [id]), returnValue: 0) as int); @override void setCurrentPlan(int? id) => - super.noSuchMethod(Invocation.method(#setCurrentPlan, [id]), - returnValueForMissingStub: null); + super.noSuchMethod(Invocation.method(#setCurrentPlan, [id]), returnValueForMissingStub: null); @override void resetCurrentPlan() => - super.noSuchMethod(Invocation.method(#resetCurrentPlan, []), - returnValueForMissingStub: null); + super.noSuchMethod(Invocation.method(#resetCurrentPlan, []), returnValueForMissingStub: null); @override - _i13.Future fetchAndSetAllPlansFull() => (super.noSuchMethod( - Invocation.method(#fetchAndSetAllPlansFull, []), - returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i13.Future); + _i13.Future fetchAndSetAllPlansFull() => + (super.noSuchMethod(Invocation.method(#fetchAndSetAllPlansFull, []), + returnValue: Future.value(), + returnValueForMissingStub: Future.value()) as _i13.Future); @override - _i13.Future fetchAndSetAllPlansSparse() => (super.noSuchMethod( - Invocation.method(#fetchAndSetAllPlansSparse, []), - returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i13.Future); + _i13.Future fetchAndSetAllPlansSparse() => + (super.noSuchMethod(Invocation.method(#fetchAndSetAllPlansSparse, []), + returnValue: Future.value(), + returnValueForMissingStub: Future.value()) as _i13.Future); @override _i13.Future<_i6.WorkoutPlan> fetchAndSetPlanSparse(int? planId) => (super.noSuchMethod(Invocation.method(#fetchAndSetPlanSparse, [planId]), @@ -134,8 +128,7 @@ class MockWorkoutPlansProvider extends _i1.Mock as _i13.Future<_i6.WorkoutPlan>); @override _i13.Future<_i6.WorkoutPlan> fetchAndSetWorkoutPlanFull(int? workoutId) => - (super.noSuchMethod( - Invocation.method(#fetchAndSetWorkoutPlanFull, [workoutId]), + (super.noSuchMethod(Invocation.method(#fetchAndSetWorkoutPlanFull, [workoutId]), returnValue: Future<_i6.WorkoutPlan>.value(_FakeWorkoutPlan_4())) as _i13.Future<_i6.WorkoutPlan>); @override @@ -146,89 +139,78 @@ class MockWorkoutPlansProvider extends _i1.Mock @override _i13.Future editWorkout(_i6.WorkoutPlan? workout) => (super.noSuchMethod(Invocation.method(#editWorkout, [workout]), - returnValue: Future.value(), - returnValueForMissingStub: Future.value()) - as _i13.Future); + returnValue: Future.value(), + returnValueForMissingStub: Future.value()) as _i13.Future); @override - _i13.Future deleteWorkout(int? id) => (super.noSuchMethod( - Invocation.method(#deleteWorkout, [id]), - returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i13.Future); + _i13.Future deleteWorkout(int? id) => + (super.noSuchMethod(Invocation.method(#deleteWorkout, [id]), + returnValue: Future.value(), + returnValueForMissingStub: Future.value()) as _i13.Future); @override _i13.Future> fetchLogData( _i6.WorkoutPlan? workout, _i14.Exercise? exercise) => (super.noSuchMethod(Invocation.method(#fetchLogData, [workout, exercise]), - returnValue: - Future>.value({})) + returnValue: Future>.value({})) as _i13.Future>); @override - _i13.Future fetchAndSetRepetitionUnits() => (super.noSuchMethod( - Invocation.method(#fetchAndSetRepetitionUnits, []), - returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i13.Future); + _i13.Future fetchAndSetRepetitionUnits() => + (super.noSuchMethod(Invocation.method(#fetchAndSetRepetitionUnits, []), + returnValue: Future.value(), + returnValueForMissingStub: Future.value()) as _i13.Future); @override - _i13.Future fetchAndSetWeightUnits() => (super.noSuchMethod( - Invocation.method(#fetchAndSetWeightUnits, []), - returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i13.Future); + _i13.Future fetchAndSetWeightUnits() => + (super.noSuchMethod(Invocation.method(#fetchAndSetWeightUnits, []), + returnValue: Future.value(), + returnValueForMissingStub: Future.value()) as _i13.Future); @override - _i13.Future fetchAndSetUnits() => (super.noSuchMethod( - Invocation.method(#fetchAndSetUnits, []), - returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i13.Future); + _i13.Future fetchAndSetUnits() => + (super.noSuchMethod(Invocation.method(#fetchAndSetUnits, []), + returnValue: Future.value(), + returnValueForMissingStub: Future.value()) as _i13.Future); @override _i13.Future<_i7.Day> addDay(_i7.Day? day, _i6.WorkoutPlan? workout) => (super.noSuchMethod(Invocation.method(#addDay, [day, workout]), - returnValue: Future<_i7.Day>.value(_FakeDay_5())) - as _i13.Future<_i7.Day>); + returnValue: Future<_i7.Day>.value(_FakeDay_5())) as _i13.Future<_i7.Day>); @override - _i13.Future editDay(_i7.Day? day) => (super.noSuchMethod( - Invocation.method(#editDay, [day]), + _i13.Future editDay(_i7.Day? day) => (super.noSuchMethod(Invocation.method(#editDay, [day]), returnValue: Future.value(), returnValueForMissingStub: Future.value()) as _i13.Future); @override - _i13.Future deleteDay(_i7.Day? day) => (super.noSuchMethod( - Invocation.method(#deleteDay, [day]), - returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i13.Future); + _i13.Future deleteDay(_i7.Day? day) => + (super.noSuchMethod(Invocation.method(#deleteDay, [day]), + returnValue: Future.value(), + returnValueForMissingStub: Future.value()) as _i13.Future); @override _i13.Future<_i8.Set> addSet(_i8.Set? workoutSet) => (super.noSuchMethod(Invocation.method(#addSet, [workoutSet]), - returnValue: Future<_i8.Set>.value(_FakeSet_6())) - as _i13.Future<_i8.Set>); + returnValue: Future<_i8.Set>.value(_FakeSet_6())) as _i13.Future<_i8.Set>); @override - _i13.Future editSet(_i8.Set? workoutSet) => (super.noSuchMethod( - Invocation.method(#editSet, [workoutSet]), - returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i13.Future); + _i13.Future editSet(_i8.Set? workoutSet) => + (super.noSuchMethod(Invocation.method(#editSet, [workoutSet]), + returnValue: Future.value(), + returnValueForMissingStub: Future.value()) as _i13.Future); @override - _i13.Future> reorderSets( - List<_i8.Set>? sets, int? startIndex) => + _i13.Future> reorderSets(List<_i8.Set>? sets, int? startIndex) => (super.noSuchMethod(Invocation.method(#reorderSets, [sets, startIndex]), - returnValue: Future>.value(<_i8.Set>[])) - as _i13.Future>); + returnValue: Future>.value(<_i8.Set>[])) as _i13.Future>); @override - _i13.Future fetchComputedSettings(_i8.Set? workoutSet) => (super - .noSuchMethod(Invocation.method(#fetchComputedSettings, [workoutSet]), - returnValue: Future.value(), - returnValueForMissingStub: Future.value()) - as _i13.Future); + _i13.Future fetchComputedSettings(_i8.Set? workoutSet) => + (super.noSuchMethod(Invocation.method(#fetchComputedSettings, [workoutSet]), + returnValue: Future.value(), + returnValueForMissingStub: Future.value()) as _i13.Future); @override - _i13.Future fetchSmartText( - _i8.Set? workoutSet, _i14.Exercise? exercise) => - (super.noSuchMethod( - Invocation.method(#fetchSmartText, [workoutSet, exercise]), + _i13.Future fetchSmartText(_i8.Set? workoutSet, _i14.Exercise? exercise) => + (super.noSuchMethod(Invocation.method(#fetchSmartText, [workoutSet, exercise]), returnValue: Future.value('')) as _i13.Future); @override - _i13.Future deleteSet(_i8.Set? workoutSet) => (super.noSuchMethod( - Invocation.method(#deleteSet, [workoutSet]), - returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i13.Future); + _i13.Future deleteSet(_i8.Set? workoutSet) => + (super.noSuchMethod(Invocation.method(#deleteSet, [workoutSet]), + returnValue: Future.value(), + returnValueForMissingStub: Future.value()) as _i13.Future); @override _i13.Future<_i9.Setting> addSetting(_i9.Setting? workoutSetting) => (super.noSuchMethod(Invocation.method(#addSetting, [workoutSetting]), - returnValue: Future<_i9.Setting>.value(_FakeSetting_7())) - as _i13.Future<_i9.Setting>); + returnValue: Future<_i9.Setting>.value(_FakeSetting_7())) as _i13.Future<_i9.Setting>); @override _i13.Future fetchSessionData() => (super.noSuchMethod(Invocation.method(#fetchSessionData, []), @@ -236,65 +218,55 @@ class MockWorkoutPlansProvider extends _i1.Mock @override _i13.Future<_i10.WorkoutSession> addSession(_i10.WorkoutSession? session) => (super.noSuchMethod(Invocation.method(#addSession, [session]), - returnValue: - Future<_i10.WorkoutSession>.value(_FakeWorkoutSession_8())) + returnValue: Future<_i10.WorkoutSession>.value(_FakeWorkoutSession_8())) as _i13.Future<_i10.WorkoutSession>); @override _i13.Future<_i11.Log> addLog(_i11.Log? log) => (super.noSuchMethod(Invocation.method(#addLog, [log]), - returnValue: Future<_i11.Log>.value(_FakeLog_9())) - as _i13.Future<_i11.Log>); + returnValue: Future<_i11.Log>.value(_FakeLog_9())) as _i13.Future<_i11.Log>); @override - _i13.Future deleteLog(_i11.Log? log) => (super.noSuchMethod( - Invocation.method(#deleteLog, [log]), - returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i13.Future); + _i13.Future deleteLog(_i11.Log? log) => + (super.noSuchMethod(Invocation.method(#deleteLog, [log]), + returnValue: Future.value(), + returnValueForMissingStub: Future.value()) as _i13.Future); @override - Uri makeUrl(String? path, - {int? id, String? objectMethod, Map? query}) => + Uri makeUrl(String? path, {int? id, String? objectMethod, Map? query}) => (super.noSuchMethod( - Invocation.method(#makeUrl, [path], - {#id: id, #objectMethod: objectMethod, #query: query}), + Invocation.method( + #makeUrl, [path], {#id: id, #objectMethod: objectMethod, #query: query}), returnValue: _FakeUri_10()) as Uri); @override - _i13.Future> fetch(Uri? uri) => (super.noSuchMethod( - Invocation.method(#fetch, [uri]), - returnValue: Future>.value({})) - as _i13.Future>); + _i13.Future> fetch(Uri? uri) => + (super.noSuchMethod(Invocation.method(#fetch, [uri]), + returnValue: Future>.value({})) + as _i13.Future>); @override - _i13.Future> post( - Map? data, Uri? uri) => + _i13.Future> post(Map? data, Uri? uri) => (super.noSuchMethod(Invocation.method(#post, [data, uri]), - returnValue: - Future>.value({})) + returnValue: Future>.value({})) as _i13.Future>); @override - _i13.Future> patch( - Map? data, Uri? uri) => + _i13.Future> patch(Map? data, Uri? uri) => (super.noSuchMethod(Invocation.method(#patch, [data, uri]), - returnValue: - Future>.value({})) + returnValue: Future>.value({})) as _i13.Future>); @override - _i13.Future<_i5.Response> deleteRequest(String? url, int? id) => - (super.noSuchMethod(Invocation.method(#deleteRequest, [url, id]), - returnValue: Future<_i5.Response>.value(_FakeResponse_11())) - as _i13.Future<_i5.Response>); + _i13.Future<_i5.Response> deleteRequest(String? url, int? id) => (super.noSuchMethod( + Invocation.method(#deleteRequest, [url, id]), + returnValue: Future<_i5.Response>.value(_FakeResponse_11())) as _i13.Future<_i5.Response>); @override String toString() => super.toString(); @override - void addListener(_i15.VoidCallback? listener) => - super.noSuchMethod(Invocation.method(#addListener, [listener]), - returnValueForMissingStub: null); + void addListener(_i15.VoidCallback? listener) => super + .noSuchMethod(Invocation.method(#addListener, [listener]), returnValueForMissingStub: null); @override void removeListener(_i15.VoidCallback? listener) => super.noSuchMethod(Invocation.method(#removeListener, [listener]), returnValueForMissingStub: null); @override - void dispose() => super.noSuchMethod(Invocation.method(#dispose, []), - returnValueForMissingStub: null); + void dispose() => + super.noSuchMethod(Invocation.method(#dispose, []), returnValueForMissingStub: null); @override void notifyListeners() => - super.noSuchMethod(Invocation.method(#notifyListeners, []), - returnValueForMissingStub: null); + super.noSuchMethod(Invocation.method(#notifyListeners, []), returnValueForMissingStub: null); } diff --git a/test/workout_set_form_test.mocks.dart b/test/workout_set_form_test.mocks.dart index 704eecf4..b6cef929 100644 --- a/test/workout_set_form_test.mocks.dart +++ b/test/workout_set_form_test.mocks.dart @@ -38,30 +38,29 @@ class MockExercisesProvider extends _i1.Mock implements _i5.ExercisesProvider { } @override - List<_i4.Exercise> get items => (super.noSuchMethod(Invocation.getter(#items), - returnValue: <_i4.Exercise>[]) as List<_i4.Exercise>); + List<_i4.Exercise> get items => + (super.noSuchMethod(Invocation.getter(#items), returnValue: <_i4.Exercise>[]) + as List<_i4.Exercise>); @override - _i2.AuthProvider get auth => (super.noSuchMethod(Invocation.getter(#auth), - returnValue: _FakeAuthProvider_0()) as _i2.AuthProvider); + _i2.AuthProvider get auth => + (super.noSuchMethod(Invocation.getter(#auth), returnValue: _FakeAuthProvider_0()) + as _i2.AuthProvider); @override set auth(_i2.AuthProvider? _auth) => - super.noSuchMethod(Invocation.setter(#auth, _auth), - returnValueForMissingStub: null); + super.noSuchMethod(Invocation.setter(#auth, _auth), returnValueForMissingStub: null); @override - _i3.Client get client => (super.noSuchMethod(Invocation.getter(#client), - returnValue: _FakeClient_1()) as _i3.Client); + _i3.Client get client => + (super.noSuchMethod(Invocation.getter(#client), returnValue: _FakeClient_1()) as _i3.Client); @override set client(_i3.Client? _client) => - super.noSuchMethod(Invocation.setter(#client, _client), - returnValueForMissingStub: null); + super.noSuchMethod(Invocation.setter(#client, _client), returnValueForMissingStub: null); @override bool get hasListeners => - (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) - as bool); + (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) as bool); @override - _i4.Exercise findById(int? exerciseId) => - (super.noSuchMethod(Invocation.method(#findById, [exerciseId]), - returnValue: _FakeExercise_2()) as _i4.Exercise); + _i4.Exercise findById(int? exerciseId) => (super + .noSuchMethod(Invocation.method(#findById, [exerciseId]), returnValue: _FakeExercise_2()) + as _i4.Exercise); @override _i6.Future fetchAndSetCategories() => (super.noSuchMethod(Invocation.method(#fetchAndSetCategories, []), @@ -80,65 +79,54 @@ class MockExercisesProvider extends _i1.Mock implements _i5.ExercisesProvider { @override _i6.Future<_i4.Exercise> fetchAndSetExercise(int? exerciseId) => (super.noSuchMethod(Invocation.method(#fetchAndSetExercise, [exerciseId]), - returnValue: Future<_i4.Exercise>.value(_FakeExercise_2())) - as _i6.Future<_i4.Exercise>); + returnValue: Future<_i4.Exercise>.value(_FakeExercise_2())) as _i6.Future<_i4.Exercise>); @override _i6.Future fetchAndSetExercises() => (super.noSuchMethod(Invocation.method(#fetchAndSetExercises, []), returnValue: Future.value(), returnValueForMissingStub: Future.value()) as _i6.Future); @override - _i6.Future> searchExercise(String? name, - [String? languageCode = r'en']) => - (super.noSuchMethod( - Invocation.method(#searchExercise, [name, languageCode]), - returnValue: Future>.value([])) - as _i6.Future>); + _i6.Future> searchExercise(String? name, [String? languageCode = r'en']) => + (super.noSuchMethod(Invocation.method(#searchExercise, [name, languageCode]), + returnValue: Future>.value([])) as _i6.Future>); @override - Uri makeUrl(String? path, - {int? id, String? objectMethod, Map? query}) => + Uri makeUrl(String? path, {int? id, String? objectMethod, Map? query}) => (super.noSuchMethod( - Invocation.method(#makeUrl, [path], - {#id: id, #objectMethod: objectMethod, #query: query}), + Invocation.method( + #makeUrl, [path], {#id: id, #objectMethod: objectMethod, #query: query}), returnValue: _FakeUri_3()) as Uri); @override - _i6.Future> fetch(Uri? uri) => (super.noSuchMethod( - Invocation.method(#fetch, [uri]), - returnValue: Future>.value({})) - as _i6.Future>); + _i6.Future> fetch(Uri? uri) => + (super.noSuchMethod(Invocation.method(#fetch, [uri]), + returnValue: Future>.value({})) + as _i6.Future>); @override _i6.Future> post(Map? data, Uri? uri) => (super.noSuchMethod(Invocation.method(#post, [data, uri]), - returnValue: - Future>.value({})) + returnValue: Future>.value({})) as _i6.Future>); @override - _i6.Future> patch( - Map? data, Uri? uri) => + _i6.Future> patch(Map? data, Uri? uri) => (super.noSuchMethod(Invocation.method(#patch, [data, uri]), - returnValue: - Future>.value({})) + returnValue: Future>.value({})) as _i6.Future>); @override _i6.Future<_i3.Response> deleteRequest(String? url, int? id) => (super.noSuchMethod(Invocation.method(#deleteRequest, [url, id]), - returnValue: Future<_i3.Response>.value(_FakeResponse_4())) - as _i6.Future<_i3.Response>); + returnValue: Future<_i3.Response>.value(_FakeResponse_4())) as _i6.Future<_i3.Response>); @override String toString() => super.toString(); @override - void addListener(_i7.VoidCallback? listener) => - super.noSuchMethod(Invocation.method(#addListener, [listener]), - returnValueForMissingStub: null); + void addListener(_i7.VoidCallback? listener) => super + .noSuchMethod(Invocation.method(#addListener, [listener]), returnValueForMissingStub: null); @override void removeListener(_i7.VoidCallback? listener) => super.noSuchMethod(Invocation.method(#removeListener, [listener]), returnValueForMissingStub: null); @override - void dispose() => super.noSuchMethod(Invocation.method(#dispose, []), - returnValueForMissingStub: null); + void dispose() => + super.noSuchMethod(Invocation.method(#dispose, []), returnValueForMissingStub: null); @override void notifyListeners() => - super.noSuchMethod(Invocation.method(#notifyListeners, []), - returnValueForMissingStub: null); + super.noSuchMethod(Invocation.method(#notifyListeners, []), returnValueForMissingStub: null); } From df387c923d3b5962775ad681da0b6aa4bdae8922 Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Thu, 28 Oct 2021 16:58:18 +0200 Subject: [PATCH 22/40] Plan is not final The object gets overwritten when a new plan gets created --- lib/widgets/nutrition/forms.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/widgets/nutrition/forms.dart b/lib/widgets/nutrition/forms.dart index 0e449dc8..16183407 100644 --- a/lib/widgets/nutrition/forms.dart +++ b/lib/widgets/nutrition/forms.dart @@ -210,7 +210,7 @@ class MealItemForm extends StatelessWidget { class PlanForm extends StatelessWidget { final _form = GlobalKey(); final _descriptionController = TextEditingController(); - late final NutritionalPlan _plan; + late NutritionalPlan _plan; PlanForm([NutritionalPlan? plan]) { _plan = plan ?? NutritionalPlan.empty(); From ff0e6758601be3fbd3297e811bb0b84b08f56c30 Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Thu, 28 Oct 2021 18:00:18 +0200 Subject: [PATCH 23/40] Some refactoring for last used ingredients It's easier to just use the already existing meal items rather than create new logs that have the same infos. --- lib/l10n/app_en.arb | 2 +- lib/models/nutrition/nutritional_plan.dart | 18 +++++ lib/widgets/nutrition/forms.dart | 73 +++++++------------ lib/widgets/nutrition/helpers.dart | 17 ----- lib/widgets/nutrition/meal.dart | 7 +- .../nutrition/nutritional_plan_detail.dart | 10 +-- test/nutritional_plan_model_test.dart | 13 +++- 7 files changed, 64 insertions(+), 76 deletions(-) diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb index 8a2b5622..77c192e5 100644 --- a/lib/l10n/app_en.arb +++ b/lib/l10n/app_en.arb @@ -480,7 +480,7 @@ "@selectIngredient": { "description": "Error message when the user hasn't selected an ingredient from the autocompleter" }, - "recentlyUsedIngredients": "Recently used ingredients. Please select one of ingredients.", + "recentlyUsedIngredients": "Recently added ingredients", "@recentlyUsedIngredients": { "description": "A message when a user adds a new ingredient to a meal." }, diff --git a/lib/models/nutrition/nutritional_plan.dart b/lib/models/nutrition/nutritional_plan.dart index 88a98f89..be71cea5 100644 --- a/lib/models/nutrition/nutritional_plan.dart +++ b/lib/models/nutrition/nutritional_plan.dart @@ -21,6 +21,7 @@ import 'package:wger/helpers/consts.dart'; import 'package:wger/helpers/json.dart'; import 'package:wger/models/nutrition/log.dart'; import 'package:wger/models/nutrition/meal.dart'; +import 'package:wger/models/nutrition/meal_item.dart'; import 'nutritrional_values.dart'; @@ -134,4 +135,21 @@ class NutritionalPlan { return out; } + + /// Helper that returns all meal items for the current plan + /// + /// Duplicated ingredients are removed + List get allMealItems { + final List out = []; + for (final meal in meals) { + for (final mealItem in meal.mealItems) { + final ingredientInList = out.where((e) => e.ingredientId == mealItem.ingredientId); + + if (ingredientInList.isEmpty) { + out.add(mealItem); + } + } + } + return out; + } } diff --git a/lib/widgets/nutrition/forms.dart b/lib/widgets/nutrition/forms.dart index 950603a7..3a5a58b4 100644 --- a/lib/widgets/nutrition/forms.dart +++ b/lib/widgets/nutrition/forms.dart @@ -24,7 +24,6 @@ import 'package:wger/exceptions/http_exception.dart'; import 'package:wger/helpers/consts.dart'; import 'package:wger/helpers/json.dart'; import 'package:wger/helpers/ui.dart'; -import 'package:wger/models/nutrition/log.dart'; import 'package:wger/models/nutrition/meal.dart'; import 'package:wger/models/nutrition/meal_item.dart'; import 'package:wger/models/nutrition/nutritional_plan.dart'; @@ -116,10 +115,10 @@ class MealForm extends StatelessWidget { class MealItemForm extends StatelessWidget { final Meal _meal; late final MealItem _mealItem; - - final List _listOfIngredientMeal; - MealItemForm(this._meal, this._listOfIngredientMeal, [mealItem]) { + final List _listMealItems; + + MealItemForm(this._meal, this._listMealItems, [mealItem]) { _mealItem = mealItem ?? MealItem.empty(); _mealItem.mealId = _meal.id!; } @@ -130,7 +129,7 @@ class MealItemForm extends StatelessWidget { @override Widget build(BuildContext context) { - final String unit = AppLocalizations.of(context).g; + final String unit = AppLocalizations.of(context).g; return Container( margin: const EdgeInsets.all(20), child: Form( @@ -204,48 +203,32 @@ class MealItemForm extends StatelessWidget { Navigator.of(context).pop(); }, ), - if (_listOfIngredientMeal.isNotEmpty) SizedBox(height: 10.0), + if (_listMealItems.isNotEmpty) const SizedBox(height: 10.0), Container( child: Text(AppLocalizations.of(context).recentlyUsedIngredients), - padding: EdgeInsets.all(10.0)), - Expanded( - child: Scrollbar( - isAlwaysShown: true, - child: ListView.builder( - itemCount: _listOfIngredientMeal.length, - shrinkWrap: true, - itemBuilder: (context, index) { - return Column( - children: [ - SizedBox( - width: double.infinity, - child: Row( - children: [ - Flexible( - child: TextButton( - child: Text( - '${_listOfIngredientMeal[index].amount.toStringAsFixed(0)}$unit ${_listOfIngredientMeal[index].ingredientObj.name}', - overflow: TextOverflow.ellipsis, - ), - onPressed: () { - _ingredientController.text = - _listOfIngredientMeal[index].ingredientObj.name; - _amountController.text = - _listOfIngredientMeal[index].amount.toStringAsFixed(0); - _mealItem.ingredientId = - _listOfIngredientMeal[index].ingredientId; - _mealItem.amount = _listOfIngredientMeal[index].amount; - }, - )), - ], - ), - ), - ], - ); - }, - ), - ), - ) + padding: const EdgeInsets.all(10.0), + ), + Expanded( + child: ListView.builder( + itemCount: _listMealItems.length, + shrinkWrap: true, + itemBuilder: (context, index) { + return Card( + child: ListTile( + onTap: () { + _ingredientController.text = _listMealItems[index].ingredientObj.name; + _amountController.text = _listMealItems[index].amount.toStringAsFixed(0); + _mealItem.ingredientId = _listMealItems[index].ingredientId; + _mealItem.amount = _listMealItems[index].amount; + }, + title: Text(_listMealItems[index].ingredientObj.name), + subtitle: Text('${_listMealItems[index].amount.toStringAsFixed(0)}$unit'), + trailing: const Icon(Icons.copy), + ), + ); + }, + ), + ) ], ), ), diff --git a/lib/widgets/nutrition/helpers.dart b/lib/widgets/nutrition/helpers.dart index 70ed9388..582282b4 100644 --- a/lib/widgets/nutrition/helpers.dart +++ b/lib/widgets/nutrition/helpers.dart @@ -18,8 +18,6 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; -import 'package:wger/models/nutrition/log.dart'; -import 'package:wger/models/nutrition/nutritional_plan.dart'; import 'package:wger/models/nutrition/nutritrional_values.dart'; import 'package:wger/widgets/core/core.dart'; @@ -50,18 +48,3 @@ List getMutedNutritionalValues(NutritionalValues values, BuildContext co ]; return out; } -List listOfIngredientsLog(NutritionalPlan nutritionalPlan) { - final List listOfIngredientMeal = []; - for (final meal in nutritionalPlan.meals) { - for (final mealItem in meal.mealItems) { - final ingredientInList = - listOfIngredientMeal.where((element) => element.ingredientId == mealItem.ingredientId); - if (ingredientInList.isEmpty) { - final log = Log.fromMealItem(mealItem, nutritionalPlan.id!, mealItem.id!); - log.ingredientObj = mealItem.ingredientObj; - listOfIngredientMeal.add(log); - } - } - } - return listOfIngredientMeal; -} \ No newline at end of file diff --git a/lib/widgets/nutrition/meal.dart b/lib/widgets/nutrition/meal.dart index a4a873fb..432a52d1 100644 --- a/lib/widgets/nutrition/meal.dart +++ b/lib/widgets/nutrition/meal.dart @@ -20,7 +20,6 @@ import 'package:flutter/material.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'package:provider/provider.dart'; import 'package:wger/helpers/consts.dart'; -import 'package:wger/models/nutrition/log.dart'; import 'package:wger/models/nutrition/meal.dart'; import 'package:wger/models/nutrition/meal_item.dart'; import 'package:wger/providers/nutrition.dart'; @@ -31,11 +30,11 @@ import 'package:wger/widgets/nutrition/helpers.dart'; class MealWidget extends StatefulWidget { final Meal _meal; - final List _listOfIngredientMeal; + final List _listMealItems; const MealWidget( this._meal, - this._listOfIngredientMeal, + this._listMealItems, ); @override @@ -130,7 +129,7 @@ class _MealWidgetState extends State { FormScreen.routeName, arguments: FormScreenArguments( AppLocalizations.of(context).addIngredient, - MealItemForm(widget._meal, widget._listOfIngredientMeal), + MealItemForm(widget._meal, widget._listMealItems), hasListView: true, ), ); diff --git a/lib/widgets/nutrition/nutritional_plan_detail.dart b/lib/widgets/nutrition/nutritional_plan_detail.dart index c8b97809..f4a0722f 100644 --- a/lib/widgets/nutrition/nutritional_plan_detail.dart +++ b/lib/widgets/nutrition/nutritional_plan_detail.dart @@ -20,7 +20,6 @@ import 'package:flutter/material.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'package:intl/intl.dart'; import 'package:provider/provider.dart'; -import 'package:wger/models/nutrition/log.dart'; import 'package:wger/models/nutrition/nutritional_plan.dart'; import 'package:wger/models/nutrition/nutritrional_values.dart'; import 'package:wger/providers/body_weight.dart'; @@ -29,7 +28,6 @@ import 'package:wger/screens/nutritional_diary_screen.dart'; import 'package:wger/theme/theme.dart'; import 'package:wger/widgets/nutrition/charts.dart'; import 'package:wger/widgets/nutrition/forms.dart'; -import 'package:wger/widgets/nutrition/helpers.dart'; import 'package:wger/widgets/nutrition/meal.dart'; class NutritionalPlanDetailWidget extends StatelessWidget { @@ -46,15 +44,13 @@ class NutritionalPlanDetailWidget extends StatelessWidget { ? _nutritionalPlan.gPerBodyKg(lastWeightEntry.weight, nutritionalValues) : null; - final List listOfIngredientMeal = listOfIngredientsLog(_nutritionalPlan); - return SliverList( delegate: SliverChildListDelegate( [ const SizedBox(height: 10), - - ..._nutritionalPlan.meals.map((meal) => MealWidget(meal, listOfIngredientMeal)).toList(), - + ..._nutritionalPlan.meals + .map((meal) => MealWidget(meal, _nutritionalPlan.allMealItems)) + .toList(), Padding( padding: const EdgeInsets.all(8.0), child: ElevatedButton( diff --git a/test/nutritional_plan_model_test.dart b/test/nutritional_plan_model_test.dart index 3ff9d69a..b0fdc0b6 100644 --- a/test/nutritional_plan_model_test.dart +++ b/test/nutritional_plan_model_test.dart @@ -17,23 +17,32 @@ */ import 'package:flutter_test/flutter_test.dart'; +import 'package:wger/models/nutrition/nutritional_plan.dart'; import 'package:wger/models/nutrition/nutritrional_values.dart'; import '../test_data/nutritional_plans.dart'; void main() { + late NutritionalPlan plan; + + setUp(() { + plan = getNutritionalPlan(); + }); + group('model tests', () { test('Test the nutritionalValues method for nutritional plans', () { - final plan = getNutritionalPlan(); final values = NutritionalValues.values(4118.75, 32.75, 347.5, 9.5, 59.0, 37.75, 52.5, 30.5); expect(plan.nutritionalValues, values); }); test('Test the nutritionalValues method for meals', () { - final plan = getNutritionalPlan(); final meal = plan.meals.first; final values = NutritionalValues.values(518.75, 5.75, 17.5, 3.5, 29.0, 13.75, 49.5, 0.5); expect(meal.nutritionalValues, values); }); + + test('Test that the getter returns all meal items for a plan', () { + expect(plan.allMealItems, plan.meals[0].mealItems + plan.meals[1].mealItems); + }); }); } From 89fa03de834aeeca4b3372014005848c6c48b7f1 Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Thu, 28 Oct 2021 18:03:26 +0200 Subject: [PATCH 24/40] Fix typo in filename --- lib/models/nutrition/log.dart | 3 +-- lib/models/nutrition/meal.dart | 3 +-- lib/models/nutrition/meal_item.dart | 3 +-- lib/models/nutrition/nutritional_plan.dart | 3 +-- .../{nutritrional_values.dart => nutritional_values.dart} | 0 lib/widgets/nutrition/charts.dart | 2 +- lib/widgets/nutrition/helpers.dart | 2 +- lib/widgets/nutrition/nutritional_diary_detail.dart | 2 +- lib/widgets/nutrition/nutritional_plan_detail.dart | 2 +- test/nutritional_plan_model_test.dart | 2 +- test/nutritional_values_class_test.dart | 2 +- 11 files changed, 10 insertions(+), 14 deletions(-) rename lib/models/nutrition/{nutritrional_values.dart => nutritional_values.dart} (100%) diff --git a/lib/models/nutrition/log.dart b/lib/models/nutrition/log.dart index 6b38a662..738c1437 100644 --- a/lib/models/nutrition/log.dart +++ b/lib/models/nutrition/log.dart @@ -21,8 +21,7 @@ import 'package:wger/helpers/json.dart'; import 'package:wger/models/nutrition/ingredient.dart'; import 'package:wger/models/nutrition/ingredient_weight_unit.dart'; import 'package:wger/models/nutrition/meal_item.dart'; - -import 'nutritrional_values.dart'; +import 'package:wger/models/nutrition/nutritional_values.dart'; part 'log.g.dart'; diff --git a/lib/models/nutrition/meal.dart b/lib/models/nutrition/meal.dart index 6b5f6543..385be9b5 100644 --- a/lib/models/nutrition/meal.dart +++ b/lib/models/nutrition/meal.dart @@ -20,8 +20,7 @@ import 'package:flutter/material.dart'; import 'package:json_annotation/json_annotation.dart'; import 'package:wger/helpers/json.dart'; import 'package:wger/models/nutrition/meal_item.dart'; - -import 'nutritrional_values.dart'; +import 'package:wger/models/nutrition/nutritional_values.dart'; part 'meal.g.dart'; diff --git a/lib/models/nutrition/meal_item.dart b/lib/models/nutrition/meal_item.dart index 4a0a9133..38ed9318 100644 --- a/lib/models/nutrition/meal_item.dart +++ b/lib/models/nutrition/meal_item.dart @@ -20,8 +20,7 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:wger/helpers/json.dart'; import 'package:wger/models/nutrition/ingredient.dart'; import 'package:wger/models/nutrition/ingredient_weight_unit.dart'; - -import 'nutritrional_values.dart'; +import 'package:wger/models/nutrition/nutritional_values.dart'; part 'meal_item.g.dart'; diff --git a/lib/models/nutrition/nutritional_plan.dart b/lib/models/nutrition/nutritional_plan.dart index be71cea5..b6fc3000 100644 --- a/lib/models/nutrition/nutritional_plan.dart +++ b/lib/models/nutrition/nutritional_plan.dart @@ -22,8 +22,7 @@ import 'package:wger/helpers/json.dart'; import 'package:wger/models/nutrition/log.dart'; import 'package:wger/models/nutrition/meal.dart'; import 'package:wger/models/nutrition/meal_item.dart'; - -import 'nutritrional_values.dart'; +import 'package:wger/models/nutrition/nutritional_values.dart'; part 'nutritional_plan.g.dart'; diff --git a/lib/models/nutrition/nutritrional_values.dart b/lib/models/nutrition/nutritional_values.dart similarity index 100% rename from lib/models/nutrition/nutritrional_values.dart rename to lib/models/nutrition/nutritional_values.dart diff --git a/lib/widgets/nutrition/charts.dart b/lib/widgets/nutrition/charts.dart index 8af27c75..83284b6c 100644 --- a/lib/widgets/nutrition/charts.dart +++ b/lib/widgets/nutrition/charts.dart @@ -20,7 +20,7 @@ import 'package:charts_flutter/flutter.dart' as charts; import 'package:flutter/widgets.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'package:wger/models/nutrition/nutritional_plan.dart'; -import 'package:wger/models/nutrition/nutritrional_values.dart'; +import 'package:wger/models/nutrition/nutritional_values.dart'; import 'package:wger/theme/theme.dart'; class NutritionData { diff --git a/lib/widgets/nutrition/helpers.dart b/lib/widgets/nutrition/helpers.dart index 582282b4..670e1b17 100644 --- a/lib/widgets/nutrition/helpers.dart +++ b/lib/widgets/nutrition/helpers.dart @@ -18,7 +18,7 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; -import 'package:wger/models/nutrition/nutritrional_values.dart'; +import 'package:wger/models/nutrition/nutritional_values.dart'; import 'package:wger/widgets/core/core.dart'; List getMutedNutritionalValues(NutritionalValues values, BuildContext context) { diff --git a/lib/widgets/nutrition/nutritional_diary_detail.dart b/lib/widgets/nutrition/nutritional_diary_detail.dart index 1f5bee76..fff02c40 100644 --- a/lib/widgets/nutrition/nutritional_diary_detail.dart +++ b/lib/widgets/nutrition/nutritional_diary_detail.dart @@ -22,7 +22,7 @@ import 'package:intl/intl.dart'; import 'package:provider/provider.dart'; import 'package:wger/models/nutrition/log.dart'; import 'package:wger/models/nutrition/nutritional_plan.dart'; -import 'package:wger/models/nutrition/nutritrional_values.dart'; +import 'package:wger/models/nutrition/nutritional_values.dart'; import 'package:wger/providers/nutrition.dart'; import 'package:wger/theme/theme.dart'; import 'package:wger/widgets/nutrition/charts.dart'; diff --git a/lib/widgets/nutrition/nutritional_plan_detail.dart b/lib/widgets/nutrition/nutritional_plan_detail.dart index f4a0722f..bb7043a0 100644 --- a/lib/widgets/nutrition/nutritional_plan_detail.dart +++ b/lib/widgets/nutrition/nutritional_plan_detail.dart @@ -21,7 +21,7 @@ import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'package:intl/intl.dart'; import 'package:provider/provider.dart'; import 'package:wger/models/nutrition/nutritional_plan.dart'; -import 'package:wger/models/nutrition/nutritrional_values.dart'; +import 'package:wger/models/nutrition/nutritional_values.dart'; import 'package:wger/providers/body_weight.dart'; import 'package:wger/screens/form_screen.dart'; import 'package:wger/screens/nutritional_diary_screen.dart'; diff --git a/test/nutritional_plan_model_test.dart b/test/nutritional_plan_model_test.dart index b0fdc0b6..e2e12746 100644 --- a/test/nutritional_plan_model_test.dart +++ b/test/nutritional_plan_model_test.dart @@ -18,7 +18,7 @@ import 'package:flutter_test/flutter_test.dart'; import 'package:wger/models/nutrition/nutritional_plan.dart'; -import 'package:wger/models/nutrition/nutritrional_values.dart'; +import 'package:wger/models/nutrition/nutritional_values.dart'; import '../test_data/nutritional_plans.dart'; diff --git a/test/nutritional_values_class_test.dart b/test/nutritional_values_class_test.dart index d818ba74..495f95fe 100644 --- a/test/nutritional_values_class_test.dart +++ b/test/nutritional_values_class_test.dart @@ -17,7 +17,7 @@ */ import 'package:flutter_test/flutter_test.dart'; -import 'package:wger/models/nutrition/nutritrional_values.dart'; +import 'package:wger/models/nutrition/nutritional_values.dart'; void main() { var values1 = NutritionalValues(); From 8d99c37cc8c3d983fa5c32ecdf1f551726b81f6d Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Wed, 27 Oct 2021 18:15:55 +0000 Subject: [PATCH 25/40] Translated using Weblate (German) Currently translated at 100.0% (149 of 149 strings) Translation: wger Workout Manager/Mobile App Translate-URL: https://hosted.weblate.org/projects/wger/mobile/de/ --- lib/l10n/app_de.arb | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/l10n/app_de.arb b/lib/l10n/app_de.arb index f5f634c6..b8fcfc6f 100644 --- a/lib/l10n/app_de.arb +++ b/lib/l10n/app_de.arb @@ -515,5 +515,17 @@ "appUpdateContent": "Diese Version der Anwendung ist nicht mit dem Server kompatibel, bitte aktualisieren Sie Ihre Anwendung.", "@appUpdateContent": {}, "appUpdateTitle": "Aktualisierung erforderlich", - "@appUpdateTitle": {} + "@appUpdateTitle": {}, + "measurements": "Messungen", + "@measurements": { + "description": "Categories for the measurements such as biceps size, body fat, etc." + }, + "dataCopied": "Daten in neuen Eintrag kopiert", + "@dataCopied": { + "description": "Snackbar message to show on copying data to a new log entry" + }, + "carbohydratesShort": "K", + "@carbohydratesShort": { + "description": "The first letter or short name of the word 'Carbohydrates', used in overviews" + } } From 8e4e6785f92f86084b3b4f03b534038e25d60715 Mon Sep 17 00:00:00 2001 From: Marko Milosevic Date: Thu, 28 Oct 2021 19:16:56 +0200 Subject: [PATCH 26/40] Fix for chart legend BUG --- lib/widgets/workouts/charts.dart | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/widgets/workouts/charts.dart b/lib/widgets/workouts/charts.dart index e238be09..6cfd628e 100644 --- a/lib/widgets/workouts/charts.dart +++ b/lib/widgets/workouts/charts.dart @@ -61,6 +61,7 @@ class LogChartWidget extends StatelessWidget { behaviors: [ charts.SeriesLegend( position: charts.BehaviorPosition.bottom, + desiredMaxColumns: 4, ), charts.RangeAnnotation([ charts.LineAnnotationSegment( From eb585b281e574bb122b689f30267b777104e6ce0 Mon Sep 17 00:00:00 2001 From: Marko Milosevic Date: Fri, 29 Oct 2021 12:58:20 +0200 Subject: [PATCH 27/40] Fix for RiR slider --- lib/widgets/workouts/forms.dart | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/widgets/workouts/forms.dart b/lib/widgets/workouts/forms.dart index 4bd887e1..27ed5728 100644 --- a/lib/widgets/workouts/forms.dart +++ b/lib/widgets/workouts/forms.dart @@ -771,6 +771,8 @@ class RiRInputWidget extends StatefulWidget { } class _RiRInputWidgetState extends State { + late double currentSetSliderValueMutable = widget._currentSetSliderValue; + /// Returns the string used in the slider String getSliderLabel(double value) { if (value < 0) { @@ -800,15 +802,15 @@ class _RiRInputWidgetState extends State { Text(AppLocalizations.of(context).rir), Expanded( child: Slider( - value: widget._currentSetSliderValue, + value: currentSetSliderValueMutable, min: RiRInputWidget.SLIDER_START, max: (Setting.POSSIBLE_RIR_VALUES.length - 2) / 2, divisions: Setting.POSSIBLE_RIR_VALUES.length - 1, - label: getSliderLabel(widget._currentSetSliderValue), + label: getSliderLabel(currentSetSliderValueMutable), onChanged: (double value) { widget._setting.setRir(mapDoubleToAllowedRir(value)); setState(() { - widget._currentSetSliderValue = value; + currentSetSliderValueMutable = value; }); }, ), From ce13c2162412a210793d06b2308c9f7b13fedda8 Mon Sep 17 00:00:00 2001 From: Milo Ivir Date: Fri, 29 Oct 2021 00:02:44 +0000 Subject: [PATCH 28/40] Translated using Weblate (Croatian) Currently translated at 100.0% (150 of 150 strings) Translation: wger Workout Manager/Mobile App Translate-URL: https://hosted.weblate.org/projects/wger/mobile/hr/ --- lib/l10n/app_hr.arb | 130 +++++++++++++++++++++++--------------------- 1 file changed, 67 insertions(+), 63 deletions(-) diff --git a/lib/l10n/app_hr.arb b/lib/l10n/app_hr.arb index 193ef073..b1f50e7b 100644 --- a/lib/l10n/app_hr.arb +++ b/lib/l10n/app_hr.arb @@ -1,5 +1,5 @@ { - "todaysWorkout": "Vaš današnji trening", + "todaysWorkout": "Tvoj današnji trening", "@todaysWorkout": {}, "mealLogged": "Obrok prijavljen u dnevnik", "@mealLogged": {}, @@ -13,7 +13,7 @@ }, "username": "Korisničko ime", "@username": {}, - "passwordsDontMatch": "Zaporke se ne podudaraju", + "passwordsDontMatch": "Lozinke se ne podudaraju", "@passwordsDontMatch": { "description": "Error message when the user enters two different passwords during registration" }, @@ -25,21 +25,21 @@ "@password": {}, "confirmPassword": "Potvrdi lozinku", "@confirmPassword": {}, - "invalidEmail": "Molimo unesite valjanu adresu e-pošte", + "invalidEmail": "Upiši valjanu e-mail adresu", "@invalidEmail": { "description": "Error message when the user enters an invalid email" }, "email": "E-mail adresa", "@email": {}, - "invalidUrl": "Unesite važeći URL", + "invalidUrl": "Upiši važeći URL", "@invalidUrl": { "description": "Error message when the user enters an invalid URL, e.g. in the login form" }, - "useCustomServer": "Koristite prilagođeni poslužitelj", + "useCustomServer": "Koristi prilagođeni poslužitelj", "@useCustomServer": { "description": "Toggle button allowing users to switch between the default and a custom wger server" }, - "invalidUsername": "Molimo unesite važeće korisničko ime", + "invalidUsername": "Upiši važeće korisničko ime", "@invalidUsername": { "description": "Error message when the user enters an invalid username" }, @@ -47,19 +47,19 @@ "@customServerUrl": { "description": "Label in the form where the users can enter their own wger instance" }, - "customServerHint": "Unesite adresu vlastitog poslužitelja, inače će se koristiti zadana", + "customServerHint": "Upiši adresu vlastitog poslužitelja, inače će se koristiti zadana", "@customServerHint": { "description": "Hint text for the form where the users can enter their own wger instance" }, - "registerInstead": "Umjesto toga se registrirajte", + "registerInstead": "Umjesto toga se registriraj", "@registerInstead": {}, - "loginInstead": "Umjesto toga se prijavite", + "loginInstead": "Umjesto toga se prijavi", "@loginInstead": {}, - "labelWorkoutPlans": "Planovi vježbanja", + "labelWorkoutPlans": "Planovi treninga", "@labelWorkoutPlans": { "description": "Title for screen workout plans" }, - "labelBottomNavWorkout": "Vježbanje", + "labelBottomNavWorkout": "Trening", "@labelBottomNavWorkout": { "description": "Label used in bottom navigation, use a short word" }, @@ -71,7 +71,7 @@ "@labelWorkoutLogs": { "description": "(Workout) logs" }, - "labelWorkoutPlan": "Plan vježbanja", + "labelWorkoutPlan": "Plan treninga", "@labelWorkoutPlan": { "description": "Title for screen workout plan" }, @@ -91,7 +91,7 @@ "@exercise": { "description": "An exercise for a workout" }, - "logHelpEntriesUnits": "Imajte na umu da su ovdje ucrtani samo unosi s jedinicom težine (kg ili lb) i ponavljanjima, druge kombinacije kao što su vrijeme ili do neuspjeha.", + "logHelpEntriesUnits": "Imaj na umu da su ovdje ucrtani samo unosi s jedinicom težine (kg ili lb) i ponavljanjima, druge kombinacije kao što su vrijeme ili do neuspjeha se ovdje zanemaruju.", "@logHelpEntriesUnits": {}, "description": "Opis", "@description": {}, @@ -101,9 +101,9 @@ }, "nutritionalDiary": "Dnevnik prehrane", "@nutritionalDiary": {}, - "nutritionalPlans": "Prehrambeni planovi", + "nutritionalPlans": "Planovi prehrane", "@nutritionalPlans": {}, - "noNutritionalPlans": "Nemate planove prehrane", + "noNutritionalPlans": "Nemaš planove prehrane", "@noNutritionalPlans": { "description": "Message shown when the user has no nutritional plans" }, @@ -119,9 +119,9 @@ "@measurements": { "description": "Categories for the measurements such as biceps size, body fat, etc." }, - "measurementCategoriesHelpText": "Kategorija mjerenja, kao što su \"bicepsi\" ili \"tjelesna mast\"", + "measurementCategoriesHelpText": "Kategorija mjerenja, kao što su „bicepsi” ili „tjelesna mast”", "@measurementCategoriesHelpText": {}, - "measurementEntriesHelpText": "Jedinica koja se koristi za mjerenje kategorije kao što je 'cm' ili '%'", + "measurementEntriesHelpText": "Jedinica koja se koristi za mjerenje kategorije kao što su „cm” ili „%”", "@measurementEntriesHelpText": {}, "date": "Datum", "@date": { @@ -135,21 +135,21 @@ "@reps": { "description": "Shorthand for repetitions, used when space constraints are tighter" }, - "rir": "RiR", + "rir": "Rezervna ponavljanja", "@rir": { "description": "Shorthand for Repetitions In Reserve" }, - "rirNotUsed": "RiR se ne koristi", + "rirNotUsed": "Rezervna ponavljanja se ne koriste", "@rirNotUsed": { "description": "Label used in RiR slider when the RiR value is not used/saved for the current setting or log" }, "macronutrients": "Makronutrijenti", "@macronutrients": {}, - "planned": "Planirani", + "planned": "Planirano", "@planned": { "description": "Header for the column of 'planned' nutritional values, i.e. what should be eaten" }, - "logged": "Zabilježen", + "logged": "Zabilježeno", "@logged": { "description": "Header for the column of 'logged' nutritional values, i.e. what was eaten" }, @@ -201,7 +201,7 @@ "@toggleDetails": { "description": "Switch to toggle detail / overview" }, - "aboutBugsText": "Javite se ako se nešto nije ponašalo kako ste očekivali ili ako postoji značajka za koju smatrate da nedostaje.", + "aboutBugsText": "Javi ako se nešto ponaša neočekivano ili ako smatraš da nedostaje neka funkcija.", "@aboutBugsText": { "description": "Text for bugs section in the about dialog" }, @@ -209,19 +209,19 @@ "@aboutContactUsTitle": { "description": "Title for contact us section in the about dialog" }, - "enterRepetitionsOrWeight": "Molimo vas da ispunite ili ponavljanja ili težinu za barem jedan od setova", + "enterRepetitionsOrWeight": "Ispuni ponavljanja ili težinu za barem jedan od setova", "@enterRepetitionsOrWeight": { "description": "Error message when the user hasn't filled in the forms for exercise sets" }, - "enterValue": "Molimo unesite vrijednost", + "enterValue": "Upiši vrijednost", "@enterValue": { "description": "Error message when the user hasn't entered a value on a required field" }, - "selectExercise": "Odaberite vježbu", + "selectExercise": "Odaberi vježbu", "@selectExercise": { "description": "Error message when the user hasn't selected an exercise in the form" }, - "enterCharacters": "Unesite znakove između {min} i {max}", + "enterCharacters": "Upiši znakove između {min} i {max}", "@enterCharacters": { "description": "Error message when the user hasn't entered the correct number of characters in a form", "type": "text", @@ -230,7 +230,7 @@ "max": {} } }, - "nrOfSets": "Setovi po vježbi: {nrOfSets}", + "nrOfSets": "Broj setova po vježbi: {nrOfSets}", "@nrOfSets": { "description": "Label shown on the slider where the user selects the nr of sets", "type": "text", @@ -238,20 +238,20 @@ "nrOfSets": {} } }, - "setUnitsAndRir": "Postavite jedinice i RiR", + "setUnitsAndRir": "Postavi jedinice i rezervna ponavljanja", "@setUnitsAndRir": { "description": "Label shown on the slider where the user can toggle showing units and RiR", "type": "text" }, - "enterValidNumber": "Unesite važeći broj", + "enterValidNumber": "Upiši važeći broj", "@enterValidNumber": { "description": "Error message when the user has submitted an invalid number (e.g. '3,.,.,.')" }, - "selectIngredient": "Molimo odaberite sastojak", + "selectIngredient": "Odaberi sastojak", "@selectIngredient": { "description": "Error message when the user hasn't selected an ingredient from the autocompleter" }, - "selectImage": "Molimo odaberite sliku", + "selectImage": "Odaberi sliku", "@selectImage": { "description": "Label and error message when the user hasn't selected an image to save" }, @@ -259,13 +259,13 @@ "@optionsLabel": { "description": "Label for the popup with general app options" }, - "takePicture": "Napravi fotografiju", + "takePicture": "Snimi sliku", "@takePicture": {}, - "chooseFromLibrary": "Odaberite iz biblioteke fotografija", + "chooseFromLibrary": "Odaberi iz biblioteke slika", "@chooseFromLibrary": {}, "gallery": "Galerija", "@gallery": {}, - "addImage": "Dodajte sliku", + "addImage": "Dodaj sliku", "@addImage": {}, "dataCopied": "Podaci kopirani u novi unos", "@dataCopied": { @@ -277,11 +277,11 @@ }, "logHelpEntries": "Ako u jednom danu postoji više od jednog unosa s istim brojem ponavljanja, ali različitim težinama, na dijagramu je prikazan samo unos s većom težinom.", "@logHelpEntries": {}, - "addSet": "Dodaj skup", + "addSet": "Dodaj set", "@addSet": { "description": "Label for the button that adds a set (to a workout day)" }, - "addMeal": "Dodajte obrok", + "addMeal": "Dodaj obrok", "@addMeal": {}, "nutritionalPlan": "Plan prehrane", "@nutritionalPlan": {}, @@ -301,7 +301,7 @@ "@register": { "description": "Text for registration button" }, - "reset": "Poništi", + "reset": "Resetiraj", "@reset": { "description": "Button text allowing the user to reset the entered values to the default" }, @@ -315,9 +315,9 @@ "@energyShort": { "description": "The first letter or short name of the word 'Energy', used in overviews" }, - "addIngredient": "Dodajte sastojak", + "addIngredient": "Dodaj sastojak", "@addIngredient": {}, - "logMeal": "Prijavite ovaj obrok", + "logMeal": "Zapiši ovaj obrok", "@logMeal": {}, "value": "Vrijednost", "@value": { @@ -331,7 +331,7 @@ "@timeStart": { "description": "The starting time of a workout" }, - "timeStartAhead": "Vrijeme početka ne može biti ispred vremena završetka", + "timeStartAhead": "Vrijeme početka ne može biti prije vremena završetka", "@timeStartAhead": {}, "ingredient": "Sastojak", "@ingredient": {}, @@ -341,7 +341,7 @@ }, "protein": "Proteini", "@protein": {}, - "goToToday": "Idite na danas", + "goToToday": "Idi na danas", "@goToToday": { "description": "Label on button to jump back to 'today' in the calendar widget" }, @@ -355,7 +355,7 @@ }, "edit": "Uredi", "@edit": {}, - "confirmDelete": "Jeste li sigurni da želite izbrisati '{toDelete}'?", + "confirmDelete": "Stvarno želiš izbrisati „{toDelete}”?", "@confirmDelete": { "description": "Confirmation text before the user deletes an object", "type": "text", @@ -365,7 +365,7 @@ }, "newNutritionalPlan": "Novi plan prehrane", "@newNutritionalPlan": {}, - "noWorkoutPlans": "Nemate planove vježbanja", + "noWorkoutPlans": "Nemaš planove treninga", "@noWorkoutPlans": { "description": "Message shown when the user has no workout plans" }, @@ -377,7 +377,7 @@ "@newEntry": { "description": "Title when adding a new entry such as a weight or log entry" }, - "noWeightEntries": "Nemate unosa težine", + "noWeightEntries": "Nemaš unose težine", "@noWeightEntries": { "description": "Message shown when the user has no logged weight entries" }, @@ -385,11 +385,11 @@ "@loadingText": { "description": "Text to show when entries are being loaded in the background: Loading..." }, - "delete": "Izbrisati", + "delete": "Izbriši", "@delete": {}, "goToDetailPage": "Idi na stranicu s detaljima", "@goToDetailPage": {}, - "aboutDescription": "Hvala vam što koristite wger! wger je suradnički projekt otvorenog koda koji su izradili ljubitelji fitnesa iz cijelog svijeta.", + "aboutDescription": "Hvala što koristiš wger! wger je suradnički projekt otvorenog koda koji su izradili ljubitelji fitnesa iz cijelog svijeta.", "@aboutDescription": { "description": "Text in the about dialog" }, @@ -397,15 +397,15 @@ "@aboutSourceTitle": { "description": "Title for source code section in the about dialog" }, - "aboutBugsTitle": "Imate li problem ili ideju?", + "aboutBugsTitle": "Imaš problem ili ideju?", "@aboutBugsTitle": { "description": "Title for bugs section in the about dialog" }, - "aboutContactUsText": "Ako želite razgovarati s nama, skočite na Discord poslužitelja i kontaktirajte nas", + "aboutContactUsText": "Ako želi razgovarati s nama, skoči na Discord poslužitelj i kontaktiraj nas", "@aboutContactUsText": { "description": "Text for contact us section in the about dialog" }, - "aboutSourceText": "Preuzmite izvorni kod ove aplikacije i njezinog poslužitelj na githubu", + "aboutSourceText": "Preuzmi izvorni kod ove aplikacije i njezinog poslužitelja na githubu", "@aboutSourceText": { "description": "Text for source code section in the about dialog" }, @@ -413,7 +413,7 @@ "@aboutTranslationTitle": { "description": "Title for translation section in the about dialog" }, - "aboutTranslationText": "Ova je aplikacija prevedena preko weblatea. Ako i vi želite pomoći, kliknite vezu i počnite prevoditi", + "aboutTranslationText": "Ova je aplikacija prevedena putem Weblatea. Ako i ti želiš pomoći, klikni poveznicu i počni prevoditi", "@aboutTranslationText": { "description": "Text for translation section in the about dialog" }, @@ -427,7 +427,7 @@ "@equipment": { "description": "Equipment needed to perform an exercise" }, - "supersetWith": "nadskup sa", + "supersetWith": "u skupu setova sa", "@supersetWith": { "description": "Text used between exercise cards when adding a new set. Translate as something like 'in a superset with'" }, @@ -435,11 +435,11 @@ "@category": { "description": "Category for an exercise, ingredient, etc." }, - "newWorkout": "Novi plan vježbanja", + "newWorkout": "Novi plan treninga", "@newWorkout": { "description": "Header when adding a new workout" }, - "searchExercise": "Pretražite vježbe za dodavanje", + "searchExercise": "Traži vježbe koje želiš dodati", "@searchExercise": { "description": "Label on set form. Selected exercises are added to the set" }, @@ -449,7 +449,7 @@ }, "dayDescriptionHelp": "Opis onoga što se radi na današnji dan (npr. 'Pull day') ili koji su dijelovi tijela trenirani (npr. 'Prsa i ramena')", "@dayDescriptionHelp": {}, - "setNr": "Skup {nr}", + "setNr": "Set {nr}", "@setNr": { "description": "Header in form indicating the number of the current set. Can also be translated as something like 'Set Nr. xy'.", "type": "text", @@ -457,7 +457,7 @@ "nr": {} } }, - "sameRepetitions": "Ako radite ista ponavljanja i težinu za sve setove, možete samo ispuniti jedan red. Na primjer, za 4 seta samo unesite 10 za ponavljanja, to automatski postaje \"4 x 10\".", + "sameRepetitions": "Ako radiš ista ponavljanja i težinu za sve setove, ispuni jedan redak. Na primjer, za 4 seta jednostavno upiši 10 za ponavljanja, to automatski postaje „4 × 10”.", "@sameRepetitions": {}, "comment": "Komentar", "@comment": { @@ -471,17 +471,17 @@ "@notes": { "description": "Personal notes, e.g. for a workout session" }, - "workoutSession": "Sesija vježbanja", + "workoutSession": "Sesija treninga", "@workoutSession": { "description": "A (logged) workout session" }, "newDay": "Novi dan", "@newDay": {}, - "newSet": "Novi skup", + "newSet": "Novi set", "@newSet": { "description": "Header when adding a new set to a workout day" }, - "selectExercises": "Ako želite napraviti superset, možete potražiti nekoliko vježbi, one će biti grupirane zajedno", + "selectExercises": "Ako želiš izraditi skup setova, potraži nekoliko vježbi i one će se spojiti u jednu grupu", "@selectExercises": {}, "gymMode": "Način rada u teretani", "@gymMode": { @@ -501,14 +501,18 @@ }, "weightUnit": "Jedinica težine", "@weightUnit": {}, - "appUpdateTitle": "Potrebno ažuriranje", + "appUpdateTitle": "Potrebna je nova verzija", "@appUpdateTitle": {}, - "appUpdateContent": "Ova verzija aplikacije nije kompatibilna s poslužiteljem. Molimo ažurirajte svoju aplikaciju.", + "appUpdateContent": "Ova verzija aplikacije nije kompatibilna s poslužiteljem. Aktualiziraj svoju aplikaciju.", "@appUpdateContent": {}, - "set": "Skup", + "set": "Set", "@set": { "description": "A set in a workout plan" }, - "repetitionUnit": "Jedinica za ponavljanje", - "@repetitionUnit": {} + "repetitionUnit": "Jedinica ponavljanja", + "@repetitionUnit": {}, + "recentlyUsedIngredients": "Nedavno dodani sastojci", + "@recentlyUsedIngredients": { + "description": "A message when a user adds a new ingredient to a meal." + } } From fde737199a872ae0d1536505043463023af542c3 Mon Sep 17 00:00:00 2001 From: Milo Ivir Date: Fri, 29 Oct 2021 14:11:52 +0000 Subject: [PATCH 29/40] Translated using Weblate (Croatian) Currently translated at 75.0% (3 of 4 strings) Translation: wger Workout Manager/Play Store Translate-URL: https://hosted.weblate.org/projects/wger/play-store/hr/ --- android/fastlane/metadata/android/hr/short_description.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 android/fastlane/metadata/android/hr/short_description.txt diff --git a/android/fastlane/metadata/android/hr/short_description.txt b/android/fastlane/metadata/android/hr/short_description.txt new file mode 100644 index 00000000..31003c01 --- /dev/null +++ b/android/fastlane/metadata/android/hr/short_description.txt @@ -0,0 +1 @@ +Praćenje fitnesa/vježbanja, prehrane i težine From 13ae0b79f369b0750531bedd11059e025db71662 Mon Sep 17 00:00:00 2001 From: Milo Ivir Date: Fri, 29 Oct 2021 15:16:04 +0000 Subject: [PATCH 30/40] Translated using Weblate (Croatian) Currently translated at 100.0% (4 of 4 strings) Translation: wger Workout Manager/Play Store Translate-URL: https://hosted.weblate.org/projects/wger/play-store/hr/ --- .../metadata/android/hr/full_description.txt | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 android/fastlane/metadata/android/hr/full_description.txt diff --git a/android/fastlane/metadata/android/hr/full_description.txt b/android/fastlane/metadata/android/hr/full_description.txt new file mode 100644 index 00000000..cb0a08c5 --- /dev/null +++ b/android/fastlane/metadata/android/hr/full_description.txt @@ -0,0 +1,39 @@ +Od ljubitelja fitnessa za ljubitelja fitnessa – organiziraj svoje zdravlje s WGER, tvojim upravljaöem treninga! + +Već si pronašao/la omiljeni program za fitness i voliš stvarati vlastite sportske rutine? Bez obzira na vrstu sportske zvijeri – svi imamo nešto zajedničko: Volimo pratiti naše zdravstvene podatke <3 + +Stoga te ne osuđujemo što još uvijek upravljaš svojim fitnessom sa svojim praktičnim malim dnevnikom vježbanja, ali nalazimo se u 2021. godini! + +Razvili smo 100 % besplatan program za digitalno praćenje zdravlja i fitnessa, s najrelevantnijim funkcijama koje će ti olakšati život. Započni, nastavi trenirati i proslavi svoj napredak! + +wger je projekt otvorenog koda za: +* Tvoje tijelo +* Tvoje treninge +* Tvoj napredak +* Tvoje podatke + +Tvoje tijelo: +Nema potrebe za guglanjem sastojaka omiljenih poslastica – odaberi dnevne obroke od više od 78.000 proizvoda i pogledaj prehrambene vrijednosti. Dodaj obroke u plan prehrane i čuvaj pregled svoje prehrane u kalendaru. + +Tvoji treninzi: +Znaš što je najbolje za tvoje tijelo. Izradi vlastite treninge iz više od 200 različitih vježbi. Zatim koristi modus teretane vođenje kroz trening dok jednim dodirom bilježiš utege. + +Tvoj napredak: +Nikada ne gubi iz vida svoje ciljeve. Prati svoju težinu i vodi statistiku. + +Tvoji podaci: +wger je tvoj personalizirani dnevnik fitnessa – ali ti posjeduješ svoje podatke. Koristi REST API za pristup i obavi s njim nevjerojatnih stvari. + +Napomena: Ovaj besplatni program ne temelji se na dodatnim sredstvima i ne tražimo da doniraš novac. Više od toga, ovo je projekt zajednice koji stalno raste. Stoga budi spreman/na za nove funkcije u bilo kojem trenutku! + +#Otvoreni kod – što to znači? + +Otvoreni kod znači da je cijeli izvorni kod za ovaj program i poslužitelj s kojim razgovara besplatan i dostupan svima: +* Želiš pokrenuti wger na vlastitom poslužitelju za sebe ili lokalnu teretanu? Izvoli! +* Nedostaje ti funkcija i želiš je implementirati? Počni odmah! +* Želiš provjeriti da se nigdje ništa ne šalje? Možeš! + +Pridruži se našoj zajednici i postani dio sportskih entuzijasta i IT geekova iz cijelog svijeta. Nastavljamo raditi na prilagodbi i optimizaciji programa prilagođen našim potrebama. Volimo tvoj doprinos, stoga se slobodno uključi u bilo koje vrijeme i doprinesi svojim željama i idejama! + +-> pronađi izvorni kod na https://github.com/wger-project +-> postavljaj pitanja ili se jednostavno predstavi na našem Discord poslužitelju https://discord.gg/rPWFv6W From 9997252e1ef4fa2fcf6ed6a98300e40f844c12eb Mon Sep 17 00:00:00 2001 From: Marko Milosevic Date: Sat, 30 Oct 2021 18:24:10 +0200 Subject: [PATCH 31/40] Removing final keyword for the RiR slider properties --- lib/widgets/workouts/forms.dart | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/lib/widgets/workouts/forms.dart b/lib/widgets/workouts/forms.dart index 27ed5728..9a1be6b6 100644 --- a/lib/widgets/workouts/forms.dart +++ b/lib/widgets/workouts/forms.dart @@ -746,8 +746,8 @@ class WeightInputWidget extends StatelessWidget { /// Can be used with a Setting or a Log object class RiRInputWidget extends StatefulWidget { final dynamic _setting; - late final String dropdownValue; - late final double _currentSetSliderValue; + late String dropdownValue; + late double _currentSetSliderValue; static const SLIDER_START = -0.5; @@ -771,8 +771,6 @@ class RiRInputWidget extends StatefulWidget { } class _RiRInputWidgetState extends State { - late double currentSetSliderValueMutable = widget._currentSetSliderValue; - /// Returns the string used in the slider String getSliderLabel(double value) { if (value < 0) { @@ -802,15 +800,15 @@ class _RiRInputWidgetState extends State { Text(AppLocalizations.of(context).rir), Expanded( child: Slider( - value: currentSetSliderValueMutable, + value: widget._currentSetSliderValue, min: RiRInputWidget.SLIDER_START, max: (Setting.POSSIBLE_RIR_VALUES.length - 2) / 2, divisions: Setting.POSSIBLE_RIR_VALUES.length - 1, - label: getSliderLabel(currentSetSliderValueMutable), + label: getSliderLabel(widget._currentSetSliderValue), onChanged: (double value) { widget._setting.setRir(mapDoubleToAllowedRir(value)); setState(() { - currentSetSliderValueMutable = value; + widget._currentSetSliderValue = value; }); }, ), From 135b905ce3020c3313dd7ca88bb6cf6fd1ef4c02 Mon Sep 17 00:00:00 2001 From: "J. Lavoie" Date: Mon, 1 Nov 2021 18:24:24 +0000 Subject: [PATCH 32/40] Translated using Weblate (German) Currently translated at 100.0% (150 of 150 strings) Translation: wger Workout Manager/Mobile App Translate-URL: https://hosted.weblate.org/projects/wger/mobile/de/ --- lib/l10n/app_de.arb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/l10n/app_de.arb b/lib/l10n/app_de.arb index b8fcfc6f..e38f9204 100644 --- a/lib/l10n/app_de.arb +++ b/lib/l10n/app_de.arb @@ -527,5 +527,9 @@ "carbohydratesShort": "K", "@carbohydratesShort": { "description": "The first letter or short name of the word 'Carbohydrates', used in overviews" + }, + "recentlyUsedIngredients": "Kürzlich hinzugefügte Zutaten", + "@recentlyUsedIngredients": { + "description": "A message when a user adds a new ingredient to a meal." } } From ca5e61a2ebc2f2c580a5412201e719a0ae9cc160 Mon Sep 17 00:00:00 2001 From: "J. Lavoie" Date: Mon, 1 Nov 2021 18:23:50 +0000 Subject: [PATCH 33/40] Translated using Weblate (Italian) Currently translated at 98.0% (147 of 150 strings) Translation: wger Workout Manager/Mobile App Translate-URL: https://hosted.weblate.org/projects/wger/mobile/it/ --- lib/l10n/app_it.arb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/l10n/app_it.arb b/lib/l10n/app_it.arb index 7a0a798c..a7bb733d 100644 --- a/lib/l10n/app_it.arb +++ b/lib/l10n/app_it.arb @@ -510,5 +510,9 @@ "description": "Header for the column of 'planned' nutritional values, i.e. what should be eaten" }, "measurement": "Misura", - "@measurement": {} + "@measurement": {}, + "recentlyUsedIngredients": "Ingredienti aggiunti di recente", + "@recentlyUsedIngredients": { + "description": "A message when a user adds a new ingredient to a meal." + } } From 990363ad0db1a1f54e6105026e396f57f3d0cc70 Mon Sep 17 00:00:00 2001 From: "J. Lavoie" Date: Mon, 1 Nov 2021 18:23:27 +0000 Subject: [PATCH 34/40] Translated using Weblate (French) Currently translated at 100.0% (150 of 150 strings) Translation: wger Workout Manager/Mobile App Translate-URL: https://hosted.weblate.org/projects/wger/mobile/fr/ --- lib/l10n/app_fr.arb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/l10n/app_fr.arb b/lib/l10n/app_fr.arb index 6681fd18..2dc2191e 100644 --- a/lib/l10n/app_fr.arb +++ b/lib/l10n/app_fr.arb @@ -522,5 +522,9 @@ "appUpdateTitle": "Mise à jour nécessaire", "@appUpdateTitle": {}, "appUpdateContent": "Cette version de l'application n'est pas compatible avec le serveur, veuillez mettre à jour votre application.", - "@appUpdateContent": {} + "@appUpdateContent": {}, + "recentlyUsedIngredients": "Ingrédients récemment ajoutés", + "@recentlyUsedIngredients": { + "description": "A message when a user adds a new ingredient to a meal." + } } From 76ce31287f3932649f55ecfd3e0984b7c3a619bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Konko=C4=BE?= Date: Wed, 3 Nov 2021 09:45:55 +0100 Subject: [PATCH 35/40] Add custom ingredient --- lib/providers/nutrition.dart | 12 +++ lib/widgets/nutrition/forms.dart | 98 +++++++++++++++++++ .../nutrition/nutritional_plan_detail.dart | 16 +++ pubspec.lock | 12 +-- pubspec.yaml | 2 +- 5 files changed, 133 insertions(+), 7 deletions(-) diff --git a/lib/providers/nutrition.dart b/lib/providers/nutrition.dart index c7052c73..70fab715 100644 --- a/lib/providers/nutrition.dart +++ b/lib/providers/nutrition.dart @@ -339,6 +339,18 @@ class NutritionPlansProvider extends WgerBaseProvider with ChangeNotifier { notifyListeners(); } +// Log custom ingredient to nutrition diary + Future logIngredentToDiary(MealItem mealItem, int planId) async { + final plan = findById(planId); + mealItem.ingredientObj = await fetchIngredient(mealItem.ingredientId); + final Log log = Log.fromMealItem(mealItem, plan.id!, null); + + final data = await post(log.toJson(), makeUrl(_nutritionDiaryPath)); + log.id = data['id']; + plan.logs.add(log); + notifyListeners(); + } + /// Deletes a log entry Future deleteLog(int logId, int planId) async { await deleteRequest(_nutritionDiaryPath, logId); diff --git a/lib/widgets/nutrition/forms.dart b/lib/widgets/nutrition/forms.dart index 3a0815e6..afaf22c8 100644 --- a/lib/widgets/nutrition/forms.dart +++ b/lib/widgets/nutrition/forms.dart @@ -236,6 +236,104 @@ class MealItemForm extends StatelessWidget { } } +class IngredientForm extends StatelessWidget { + late MealItem _mealItem; + final int _planId; + + IngredientForm(this._planId) { + _mealItem = MealItem.empty(); + } + + final _form = GlobalKey(); + final _ingredientController = TextEditingController(); + final _amountController = TextEditingController(); + + @override + Widget build(BuildContext context) { + return Container( + margin: EdgeInsets.all(20), + child: Form( + key: _form, + child: Column( + children: [ + TypeAheadFormField( + textFieldConfiguration: TextFieldConfiguration( + controller: _ingredientController, + decoration: InputDecoration( + labelText: AppLocalizations.of(context).ingredient), + ), + suggestionsCallback: (pattern) async { + return Provider.of(context, + listen: false) + .searchIngredient( + pattern, + Localizations.localeOf(context).languageCode, + ); + }, + itemBuilder: (context, dynamic suggestion) { + return ListTile( + title: Text(suggestion['value']), + subtitle: Text(suggestion['data']['id'].toString()), + ); + }, + transitionBuilder: (context, suggestionsBox, controller) { + return suggestionsBox; + }, + onSuggestionSelected: (dynamic suggestion) { + _mealItem.ingredientId = suggestion['data']['id']; + _ingredientController.text = suggestion['value']; + }, + validator: (value) { + if (value!.isEmpty) { + return AppLocalizations.of(context).selectIngredient; + } + return null; + }, + ), + TextFormField( + decoration: InputDecoration( + labelText: AppLocalizations.of(context).weight), + controller: _amountController, + keyboardType: TextInputType.number, + onFieldSubmitted: (_) {}, + onSaved: (newValue) { + _mealItem.amount = double.parse(newValue!); + }, + validator: (value) { + try { + double.parse(value!); + } catch (error) { + return AppLocalizations.of(context).enterValidNumber; + } + return null; + }, + ), + ElevatedButton( + child: Text(AppLocalizations.of(context).save), + onPressed: () async { + if (!_form.currentState!.validate()) { + return; + } + _form.currentState!.save(); + + try { + Provider.of(context, listen: false) + .logIngredentToDiary(_mealItem, _planId); + } on WgerHttpException catch (error) { + showHttpExceptionErrorDialog(error, context); + } catch (error) { + showErrorDialog(error, context); + } + Navigator.of(context).pop(); + }, + ), + ], + ), + ), + ); + } +} + class PlanForm extends StatelessWidget { final _form = GlobalKey(); final _descriptionController = TextEditingController(); diff --git a/lib/widgets/nutrition/nutritional_plan_detail.dart b/lib/widgets/nutrition/nutritional_plan_detail.dart index bb7043a0..689a673f 100644 --- a/lib/widgets/nutrition/nutritional_plan_detail.dart +++ b/lib/widgets/nutrition/nutritional_plan_detail.dart @@ -67,6 +67,22 @@ class NutritionalPlanDetailWidget extends StatelessWidget { }, ), ), + Padding( + padding: const EdgeInsets.all(8.0), + child: ElevatedButton( + child: Text(AppLocalizations.of(context).addIngredient), + onPressed: () { + Navigator.pushNamed( + context, + FormScreen.routeName, + arguments: FormScreenArguments( + AppLocalizations.of(context).addIngredient, + IngredientForm(_nutritionalPlan.id!), + ), + ); + }, + ), + ), Container( padding: const EdgeInsets.all(15), height: 220, diff --git a/pubspec.lock b/pubspec.lock index f333a21c..d957b2c6 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -14,7 +14,7 @@ packages: name: analyzer url: "https://pub.dartlang.org" source: hosted - version: "1.7.2" + version: "1.7.1" android_metadata: dependency: "direct main" description: @@ -42,7 +42,7 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.8.1" + version: "2.6.1" boolean_selector: dependency: transitive description: @@ -133,7 +133,7 @@ packages: name: charcode url: "https://pub.dartlang.org" source: hosted - version: "1.3.1" + version: "1.2.0" charts_common: dependency: transitive description: @@ -524,7 +524,7 @@ packages: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.7.0" + version: "1.3.0" mime: dependency: transitive description: @@ -692,7 +692,7 @@ packages: name: rive url: "https://pub.dartlang.org" source: hosted - version: "0.7.33" + version: "0.7.28" shared_preferences: dependency: "direct main" description: @@ -823,7 +823,7 @@ packages: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.4.2" + version: "0.3.0" timing: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index ac73cd78..b97a1891 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -47,7 +47,7 @@ dependencies: version: ^2.0.0 package_info: ^2.0.2 provider: ^5.0.0 - rive: ^0.7.33 + rive: 0.7.28 shared_preferences: ^2.0.7 table_calendar: ^3.0.2 url_launcher: ^6.0.10 From 504e4ffaba64dfa3ce6a9439776ee43301ca41ec Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Wed, 3 Nov 2021 19:41:05 +0100 Subject: [PATCH 36/40] Refactor ingredient search widget --- lib/l10n/app_en.arb | 6 + lib/providers/nutrition.dart | 6 +- lib/screens/nutritional_plan_screen.dart | 14 +- lib/widgets/nutrition/forms.dart | 132 +++++++----------- .../nutrition/nutritional_plan_detail.dart | 16 --- lib/widgets/nutrition/widgets.dart | 74 ++++++++++ pubspec.lock | 2 +- pubspec.yaml | 2 +- 8 files changed, 148 insertions(+), 104 deletions(-) create mode 100644 lib/widgets/nutrition/widgets.dart diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb index 77c192e5..be62be29 100644 --- a/lib/l10n/app_en.arb +++ b/lib/l10n/app_en.arb @@ -242,6 +242,12 @@ "@logMeal": {}, "addIngredient": "Add ingredient", "@addIngredient": {}, + "logIngredient": "Save to nutrition diary", + "@logIngredient": {}, + "searchIngredient": "Search ingredient", + "@searchIngredient": { + "description": "Label on ingredient search form" + }, "nutritionalPlan": "Nutritional plan", "@nutritionalPlan": {}, "nutritionalDiary": "Nutritional diary", diff --git a/lib/providers/nutrition.dart b/lib/providers/nutrition.dart index 70fab715..a7228134 100644 --- a/lib/providers/nutrition.dart +++ b/lib/providers/nutrition.dart @@ -339,11 +339,11 @@ class NutritionPlansProvider extends WgerBaseProvider with ChangeNotifier { notifyListeners(); } -// Log custom ingredient to nutrition diary - Future logIngredentToDiary(MealItem mealItem, int planId) async { + /// Log custom ingredient to nutrition diary + Future logIngredentToDiary(MealItem mealItem, int planId, [DateTime? dateTime]) async { final plan = findById(planId); mealItem.ingredientObj = await fetchIngredient(mealItem.ingredientId); - final Log log = Log.fromMealItem(mealItem, plan.id!, null); + final Log log = Log.fromMealItem(mealItem, plan.id!, null, dateTime); final data = await post(log.toJson(), makeUrl(_nutritionDiaryPath)); log.id = data['id']; diff --git a/lib/screens/nutritional_plan_screen.dart b/lib/screens/nutritional_plan_screen.dart index eacf8d6a..172e8eb9 100644 --- a/lib/screens/nutritional_plan_screen.dart +++ b/lib/screens/nutritional_plan_screen.dart @@ -44,7 +44,19 @@ class NutritionalPlanScreen extends StatelessWidget { return Scaffold( //appBar: getAppBar(nutritionalPlan), - //drawer: AppDrawer(), + floatingActionButton: FloatingActionButton( + child: const Icon(Icons.history_edu), + onPressed: () { + Navigator.pushNamed( + context, + FormScreen.routeName, + arguments: FormScreenArguments( + AppLocalizations.of(context).logIngredient, + IngredientLogForm(_nutritionalPlan), + ), + ); + }, + ), body: CustomScrollView( slivers: [ SliverAppBar( diff --git a/lib/widgets/nutrition/forms.dart b/lib/widgets/nutrition/forms.dart index afaf22c8..6bff2a12 100644 --- a/lib/widgets/nutrition/forms.dart +++ b/lib/widgets/nutrition/forms.dart @@ -18,7 +18,6 @@ import 'package:flutter/material.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; -import 'package:flutter_typeahead/flutter_typeahead.dart'; import 'package:provider/provider.dart'; import 'package:wger/exceptions/http_exception.dart'; import 'package:wger/helpers/consts.dart'; @@ -29,6 +28,7 @@ import 'package:wger/models/nutrition/meal_item.dart'; import 'package:wger/models/nutrition/nutritional_plan.dart'; import 'package:wger/providers/nutrition.dart'; import 'package:wger/screens/nutritional_plan_screen.dart'; +import 'package:wger/widgets/nutrition/widgets.dart'; class MealForm extends StatelessWidget { late final Meal _meal; @@ -115,18 +115,18 @@ class MealForm extends StatelessWidget { class MealItemForm extends StatelessWidget { final Meal _meal; late final MealItem _mealItem; - final List _listMealItems; + final _form = GlobalKey(); + final _ingredientIdController = TextEditingController(); + final _ingredientController = TextEditingController(); + final _amountController = TextEditingController(); + MealItemForm(this._meal, this._listMealItems, [mealItem]) { _mealItem = mealItem ?? MealItem.empty(); _mealItem.mealId = _meal.id!; } - final _form = GlobalKey(); - final _ingredientController = TextEditingController(); - final _amountController = TextEditingController(); - @override Widget build(BuildContext context) { final String unit = AppLocalizations.of(context).g; @@ -136,37 +136,7 @@ class MealItemForm extends StatelessWidget { key: _form, child: Column( children: [ - TypeAheadFormField( - textFieldConfiguration: TextFieldConfiguration( - controller: _ingredientController, - decoration: InputDecoration(labelText: AppLocalizations.of(context).ingredient), - ), - suggestionsCallback: (pattern) async { - return Provider.of(context, listen: false).searchIngredient( - pattern, - Localizations.localeOf(context).languageCode, - ); - }, - itemBuilder: (context, dynamic suggestion) { - return ListTile( - title: Text(suggestion['value']), - subtitle: Text(suggestion['data']['id'].toString()), - ); - }, - transitionBuilder: (context, suggestionsBox, controller) { - return suggestionsBox; - }, - onSuggestionSelected: (dynamic suggestion) { - _mealItem.ingredientId = suggestion['data']['id']; - _ingredientController.text = suggestion['value']; - }, - validator: (value) { - if (value!.isEmpty) { - return AppLocalizations.of(context).selectIngredient; - } - return null; - }, - ), + IngredientTypeahead(_ingredientIdController, _ingredientController), TextFormField( decoration: InputDecoration(labelText: AppLocalizations.of(context).weight), controller: _amountController, @@ -191,6 +161,7 @@ class MealItemForm extends StatelessWidget { return; } _form.currentState!.save(); + _mealItem.ingredientId = int.parse(_ingredientIdController.text); try { Provider.of(context, listen: false) @@ -217,6 +188,8 @@ class MealItemForm extends StatelessWidget { child: ListTile( onTap: () { _ingredientController.text = _listMealItems[index].ingredientObj.name; + _ingredientIdController.text = + _listMealItems[index].ingredientObj.id.toString(); _amountController.text = _listMealItems[index].amount.toStringAsFixed(0); _mealItem.ingredientId = _listMealItems[index].ingredientId; _mealItem.amount = _listMealItems[index].amount; @@ -236,63 +209,32 @@ class MealItemForm extends StatelessWidget { } } -class IngredientForm extends StatelessWidget { +class IngredientLogForm extends StatelessWidget { late MealItem _mealItem; - final int _planId; - - IngredientForm(this._planId) { - _mealItem = MealItem.empty(); - } + final NutritionalPlan _plan; final _form = GlobalKey(); final _ingredientController = TextEditingController(); + final _ingredientIdController = TextEditingController(); final _amountController = TextEditingController(); + final _dateController = TextEditingController(); + + IngredientLogForm(this._plan) { + _mealItem = MealItem.empty(); + _dateController.text = toDate(DateTime.now())!; + } @override Widget build(BuildContext context) { return Container( - margin: EdgeInsets.all(20), + margin: const EdgeInsets.all(20), child: Form( key: _form, child: Column( children: [ - TypeAheadFormField( - textFieldConfiguration: TextFieldConfiguration( - controller: _ingredientController, - decoration: InputDecoration( - labelText: AppLocalizations.of(context).ingredient), - ), - suggestionsCallback: (pattern) async { - return Provider.of(context, - listen: false) - .searchIngredient( - pattern, - Localizations.localeOf(context).languageCode, - ); - }, - itemBuilder: (context, dynamic suggestion) { - return ListTile( - title: Text(suggestion['value']), - subtitle: Text(suggestion['data']['id'].toString()), - ); - }, - transitionBuilder: (context, suggestionsBox, controller) { - return suggestionsBox; - }, - onSuggestionSelected: (dynamic suggestion) { - _mealItem.ingredientId = suggestion['data']['id']; - _ingredientController.text = suggestion['value']; - }, - validator: (value) { - if (value!.isEmpty) { - return AppLocalizations.of(context).selectIngredient; - } - return null; - }, - ), + IngredientTypeahead(_ingredientIdController, _ingredientController), TextFormField( - decoration: InputDecoration( - labelText: AppLocalizations.of(context).weight), + decoration: InputDecoration(labelText: AppLocalizations.of(context).weight), controller: _amountController, keyboardType: TextInputType.number, onFieldSubmitted: (_) {}, @@ -308,6 +250,31 @@ class IngredientForm extends StatelessWidget { return null; }, ), + TextFormField( + readOnly: true, // Stop keyboard from appearing + decoration: InputDecoration( + labelText: AppLocalizations.of(context).date, + suffixIcon: const Icon(Icons.calendar_today_outlined), + ), + enableInteractiveSelection: false, + controller: _dateController, + onTap: () async { + // Show Date Picker Here + final pickedDate = await showDatePicker( + context: context, + initialDate: DateTime.now(), + firstDate: DateTime(DateTime.now().year - 10), + lastDate: DateTime.now(), + ); + + if (pickedDate != null) { + _dateController.text = toDate(pickedDate)!; + } + }, + onSaved: (newValue) { + _dateController.text = newValue!; + }, + ), ElevatedButton( child: Text(AppLocalizations.of(context).save), onPressed: () async { @@ -315,10 +282,11 @@ class IngredientForm extends StatelessWidget { return; } _form.currentState!.save(); + _mealItem.ingredientId = int.parse(_ingredientIdController.text); try { - Provider.of(context, listen: false) - .logIngredentToDiary(_mealItem, _planId); + Provider.of(context, listen: false).logIngredentToDiary( + _mealItem, _plan.id!, DateTime.parse(_dateController.text)); } on WgerHttpException catch (error) { showHttpExceptionErrorDialog(error, context); } catch (error) { diff --git a/lib/widgets/nutrition/nutritional_plan_detail.dart b/lib/widgets/nutrition/nutritional_plan_detail.dart index 689a673f..bb7043a0 100644 --- a/lib/widgets/nutrition/nutritional_plan_detail.dart +++ b/lib/widgets/nutrition/nutritional_plan_detail.dart @@ -67,22 +67,6 @@ class NutritionalPlanDetailWidget extends StatelessWidget { }, ), ), - Padding( - padding: const EdgeInsets.all(8.0), - child: ElevatedButton( - child: Text(AppLocalizations.of(context).addIngredient), - onPressed: () { - Navigator.pushNamed( - context, - FormScreen.routeName, - arguments: FormScreenArguments( - AppLocalizations.of(context).addIngredient, - IngredientForm(_nutritionalPlan.id!), - ), - ); - }, - ), - ), Container( padding: const EdgeInsets.all(15), height: 220, diff --git a/lib/widgets/nutrition/widgets.dart b/lib/widgets/nutrition/widgets.dart new file mode 100644 index 00000000..5e4fb00e --- /dev/null +++ b/lib/widgets/nutrition/widgets.dart @@ -0,0 +1,74 @@ +/* + * This file is part of wger Workout Manager . + * Copyright (C) 2020, 2021 wger Team + * + * wger Workout Manager is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * wger Workout Manager is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import 'package:flutter/material.dart'; +import 'package:flutter/widgets.dart'; +import 'package:flutter_gen/gen_l10n/app_localizations.dart'; +import 'package:flutter_typeahead/flutter_typeahead.dart'; +import 'package:provider/provider.dart'; +import 'package:wger/providers/nutrition.dart'; + +class IngredientTypeahead extends StatefulWidget { + final TextEditingController _ingredientController; + final TextEditingController _ingredientIdController; + + IngredientTypeahead(this._ingredientIdController, this._ingredientController); + + @override + _IngredientTypeaheadState createState() => _IngredientTypeaheadState(); +} + +class _IngredientTypeaheadState extends State { + @override + Widget build(BuildContext context) { + return TypeAheadFormField( + textFieldConfiguration: TextFieldConfiguration( + controller: widget._ingredientController, + decoration: InputDecoration( + labelText: AppLocalizations.of(context).searchIngredient, + suffixIcon: const Icon(Icons.search), + ), + ), + suggestionsCallback: (pattern) async { + return Provider.of(context, listen: false).searchIngredient( + pattern, + Localizations.localeOf(context).languageCode, + ); + }, + itemBuilder: (context, dynamic suggestion) { + return ListTile( + title: Text(suggestion['value']), + subtitle: Text(suggestion['data']['id'].toString()), + ); + }, + transitionBuilder: (context, suggestionsBox, controller) { + return suggestionsBox; + }, + onSuggestionSelected: (dynamic suggestion) { + widget._ingredientIdController.text = suggestion['data']['id'].toString(); + widget._ingredientController.text = suggestion['value']; + }, + validator: (value) { + if (value!.isEmpty) { + return AppLocalizations.of(context).selectIngredient; + } + return null; + }, + ); + } +} diff --git a/pubspec.lock b/pubspec.lock index d957b2c6..ed2de5b6 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -692,7 +692,7 @@ packages: name: rive url: "https://pub.dartlang.org" source: hosted - version: "0.7.28" + version: "0.7.33" shared_preferences: dependency: "direct main" description: diff --git a/pubspec.yaml b/pubspec.yaml index b97a1891..ac73cd78 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -47,7 +47,7 @@ dependencies: version: ^2.0.0 package_info: ^2.0.2 provider: ^5.0.0 - rive: 0.7.28 + rive: ^0.7.33 shared_preferences: ^2.0.7 table_calendar: ^3.0.2 url_launcher: ^6.0.10 From 60273ebdc47335f840e94115d04c8c19692b226b Mon Sep 17 00:00:00 2001 From: Github-actions Date: Wed, 3 Nov 2021 18:43:02 +0000 Subject: [PATCH 37/40] Automatic linting --- pubspec.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pubspec.lock b/pubspec.lock index ed2de5b6..f333a21c 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -14,7 +14,7 @@ packages: name: analyzer url: "https://pub.dartlang.org" source: hosted - version: "1.7.1" + version: "1.7.2" android_metadata: dependency: "direct main" description: @@ -42,7 +42,7 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.6.1" + version: "2.8.1" boolean_selector: dependency: transitive description: @@ -133,7 +133,7 @@ packages: name: charcode url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "1.3.1" charts_common: dependency: transitive description: @@ -524,7 +524,7 @@ packages: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.3.0" + version: "1.7.0" mime: dependency: transitive description: @@ -823,7 +823,7 @@ packages: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.3.0" + version: "0.4.2" timing: dependency: transitive description: From 3735d8d59d29422f5400b71422c4e580385a17f9 Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Wed, 3 Nov 2021 19:49:11 +0100 Subject: [PATCH 38/40] Update to flutter 2.5 --- .github/workflows/android-release.yml | 2 +- README.md | 2 +- pubspec.lock | 72 +++++++++++++++++++-------- pubspec.yaml | 2 +- 4 files changed, 53 insertions(+), 25 deletions(-) diff --git a/.github/workflows/android-release.yml b/.github/workflows/android-release.yml index de6a948b..9ed81aa9 100644 --- a/.github/workflows/android-release.yml +++ b/.github/workflows/android-release.yml @@ -32,7 +32,7 @@ jobs: uses: subosito/flutter-action@v1 with: channel: 'stable' - flutter-version: '2.2.x' + flutter-version: '2.5.x' - run: dart --version - run: flutter --version diff --git a/README.md b/README.md index 5711fedb..f0d2ff5f 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ Alternatively, you can use one of our test servers, just ask us for access. Install Flutter, all its dependencies and create a new virtual device: . -The app currently uses flutter 2.2 +The app currently uses flutter 2.5 ### 3 Create a new file ``wger.properties`` in ``android/fastlane/envfiles``: diff --git a/pubspec.lock b/pubspec.lock index f333a21c..f83d717e 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -56,7 +56,7 @@ packages: name: build url: "https://pub.dartlang.org" source: hosted - version: "2.1.0" + version: "2.1.1" build_config: dependency: transitive description: @@ -70,7 +70,7 @@ packages: name: build_daemon url: "https://pub.dartlang.org" source: hosted - version: "3.0.0" + version: "3.0.1" build_resolvers: dependency: transitive description: @@ -84,14 +84,14 @@ packages: name: build_runner url: "https://pub.dartlang.org" source: hosted - version: "2.1.2" + version: "2.1.4" build_runner_core: dependency: transitive description: name: build_runner_core url: "https://pub.dartlang.org" source: hosted - version: "7.1.0" + version: "7.2.2" built_collection: dependency: transitive description: @@ -112,7 +112,7 @@ packages: name: camera url: "https://pub.dartlang.org" source: hosted - version: "0.9.2+2" + version: "0.9.4+3" camera_platform_interface: dependency: transitive description: @@ -120,6 +120,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.1.1" + camera_web: + dependency: transitive + description: + name: camera_web + url: "https://pub.dartlang.org" + source: hosted + version: "0.2.1+1" characters: dependency: transitive description: @@ -140,14 +147,14 @@ packages: name: charts_common url: "https://pub.dartlang.org" source: hosted - version: "0.11.0" + version: "0.12.0" charts_flutter: dependency: "direct main" description: name: charts_flutter url: "https://pub.dartlang.org" source: hosted - version: "0.11.0" + version: "0.12.0" checked_yaml: dependency: transitive description: @@ -398,7 +405,7 @@ packages: name: glob url: "https://pub.dartlang.org" source: hosted - version: "2.0.1" + version: "2.0.2" graphs: dependency: transitive description: @@ -419,7 +426,7 @@ packages: name: http url: "https://pub.dartlang.org" source: hosted - version: "0.13.3" + version: "0.13.4" http_multi_server: dependency: transitive description: @@ -447,7 +454,7 @@ packages: name: image_picker url: "https://pub.dartlang.org" source: hosted - version: "0.8.4+1" + version: "0.8.4+4" image_picker_for_web: dependency: transitive description: @@ -489,7 +496,7 @@ packages: name: json_annotation url: "https://pub.dartlang.org" source: hosted - version: "4.0.1" + version: "4.1.0" json_serializable: dependency: "direct dev" description: @@ -629,7 +636,7 @@ packages: name: petitparser url: "https://pub.dartlang.org" source: hosted - version: "4.1.0" + version: "4.4.0" platform: dependency: transitive description: @@ -657,7 +664,7 @@ packages: name: process url: "https://pub.dartlang.org" source: hosted - version: "4.2.3" + version: "4.2.4" provider: dependency: "direct main" description: @@ -678,7 +685,7 @@ packages: name: pubspec_parse url: "https://pub.dartlang.org" source: hosted - version: "1.0.0" + version: "1.1.0" quiver: dependency: transitive description: @@ -699,7 +706,7 @@ packages: name: shared_preferences url: "https://pub.dartlang.org" source: hosted - version: "2.0.7" + version: "2.0.8" shared_preferences_linux: dependency: transitive description: @@ -851,7 +858,7 @@ packages: name: url_launcher url: "https://pub.dartlang.org" source: hosted - version: "6.0.10" + version: "6.0.12" url_launcher_linux: dependency: transitive description: @@ -907,7 +914,7 @@ packages: name: video_player url: "https://pub.dartlang.org" source: hosted - version: "2.2.3" + version: "2.2.6" video_player_platform_interface: dependency: transitive description: @@ -963,7 +970,7 @@ packages: name: watcher url: "https://pub.dartlang.org" source: hosted - version: "1.0.0" + version: "1.0.1" web_socket_channel: dependency: transitive description: @@ -977,7 +984,28 @@ packages: name: webview_flutter url: "https://pub.dartlang.org" source: hosted - version: "2.0.13" + version: "2.1.2" + webview_flutter_android: + dependency: transitive + description: + name: webview_flutter_android + url: "https://pub.dartlang.org" + source: hosted + version: "2.2.0" + webview_flutter_platform_interface: + dependency: transitive + description: + name: webview_flutter_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "1.3.0" + webview_flutter_wkwebview: + dependency: transitive + description: + name: webview_flutter_wkwebview + url: "https://pub.dartlang.org" + source: hosted + version: "2.2.0" win32: dependency: transitive description: @@ -998,7 +1026,7 @@ packages: name: xml url: "https://pub.dartlang.org" source: hosted - version: "5.1.2" + version: "5.3.1" yaml: dependency: transitive description: @@ -1007,5 +1035,5 @@ packages: source: hosted version: "3.1.0" sdks: - dart: ">=2.13.0 <3.0.0" - flutter: ">=2.2.0" + dart: ">=2.14.0 <3.0.0" + flutter: ">=2.5.0" diff --git a/pubspec.yaml b/pubspec.yaml index ac73cd78..3b9d3b2f 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -33,7 +33,7 @@ dependencies: android_metadata: ^0.2.1 camera: ^0.9.2+2 - charts_flutter: ^0.11.0 + charts_flutter: ^0.12.0 collection: ^1.15.0-nullsafety.4 cupertino_icons: ^1.0.0 flutter_calendar_carousel: ^2.0.3 From 4c1bcd492875bfd2dfe73a75d230f8e4436b45b2 Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Wed, 3 Nov 2021 19:55:15 +0100 Subject: [PATCH 39/40] Fix app bar color --- lib/theme/theme.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/theme/theme.dart b/lib/theme/theme.dart index 3ee49f51..19a9ae72 100644 --- a/lib/theme/theme.dart +++ b/lib/theme/theme.dart @@ -58,8 +58,8 @@ final ThemeData wgerTheme = ThemeData( // Show icons in the system's bar in light colors appBarTheme: const AppBarTheme( - brightness: Brightness.dark, systemOverlayStyle: SystemUiOverlayStyle.dark, + color: wgerPrimaryColor, ), /* From 9d6d3fcc259c145e87bd4c5ec0090cb236de51a3 Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Wed, 3 Nov 2021 20:04:19 +0100 Subject: [PATCH 40/40] Add quick link to log to diary on dashboard --- lib/widgets/dashboard/widgets.dart | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/lib/widgets/dashboard/widgets.dart b/lib/widgets/dashboard/widgets.dart index 8b779376..993582a8 100644 --- a/lib/widgets/dashboard/widgets.dart +++ b/lib/widgets/dashboard/widgets.dart @@ -199,14 +199,28 @@ class _DashboardNutritionWidgetState extends State { ), if (_hasContent) Row( - mainAxisAlignment: MainAxisAlignment.end, + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ TextButton( - child: Text(AppLocalizations.of(context).goToDetailPage), - onPressed: () { - Navigator.of(context) - .pushNamed(NutritionalPlanScreen.routeName, arguments: _plan); - }), + child: Text(AppLocalizations.of(context).logIngredient), + onPressed: () { + Navigator.pushNamed( + context, + FormScreen.routeName, + arguments: FormScreenArguments( + AppLocalizations.of(context).logIngredient, + IngredientLogForm(_plan!), + ), + ); + }, + ), + TextButton( + child: Text(AppLocalizations.of(context).goToDetailPage), + onPressed: () { + Navigator.of(context) + .pushNamed(NutritionalPlanScreen.routeName, arguments: _plan); + }, + ), ], ), ],