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 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/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 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 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 diff --git a/lib/l10n/app_de.arb b/lib/l10n/app_de.arb index f200d9fa..e38f9204 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": { @@ -509,5 +509,27 @@ "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": {}, + "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" + }, + "recentlyUsedIngredients": "Kürzlich hinzugefügte Zutaten", + "@recentlyUsedIngredients": { + "description": "A message when a user adds a new ingredient to a meal." } } diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb index 74781454..17df7652 100644 --- a/lib/l10n/app_en.arb +++ b/lib/l10n/app_en.arb @@ -250,6 +250,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", @@ -488,6 +494,10 @@ "@selectIngredient": { "description": "Error message when the user hasn't selected an ingredient from the autocompleter" }, + "recentlyUsedIngredients": "Recently added 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/l10n/app_fr.arb b/lib/l10n/app_fr.arb index 795bcfe2..2dc2191e 100644 --- a/lib/l10n/app_fr.arb +++ b/lib/l10n/app_fr.arb @@ -518,5 +518,13 @@ "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": {}, + "recentlyUsedIngredients": "Ingrédients récemment ajoutés", + "@recentlyUsedIngredients": { + "description": "A message when a user adds a new ingredient to a meal." } } 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." + } } diff --git a/lib/l10n/app_it.arb b/lib/l10n/app_it.arb index 409110c1..a7bb733d 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" }, @@ -448,5 +448,71 @@ "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" + }, + "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": {}, + "recentlyUsedIngredients": "Ingredienti aggiunti di recente", + "@recentlyUsedIngredients": { + "description": "A message when a user adds a new ingredient to a meal." } } 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": {} + } + } } diff --git a/lib/models/nutrition/log.dart b/lib/models/nutrition/log.dart index fec9c607..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'; @@ -31,6 +30,9 @@ class Log { @JsonKey(required: true) int? id; + @JsonKey(required: false, name: 'meal') + int? mealId; + @JsonKey(required: true, name: 'plan') int planId; @@ -56,6 +58,7 @@ class Log { Log({ this.id, + required this.mealId, required this.ingredientId, required this.weightUnitId, required this.amount, @@ -64,7 +67,7 @@ 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; diff --git a/lib/models/nutrition/log.g.dart b/lib/models/nutrition/log.g.dart index 3bda3119..f9c16113 100644 --- a/lib/models/nutrition/log.g.dart +++ b/lib/models/nutrition/log.g.dart @@ -17,6 +17,7 @@ Log _$LogFromJson(Map json) { ]); 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?), @@ -28,6 +29,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, 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 88a98f89..b6fc3000 100644 --- a/lib/models/nutrition/nutritional_plan.dart +++ b/lib/models/nutrition/nutritional_plan.dart @@ -21,8 +21,8 @@ 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 'nutritrional_values.dart'; +import 'package:wger/models/nutrition/meal_item.dart'; +import 'package:wger/models/nutrition/nutritional_values.dart'; part 'nutritional_plan.g.dart'; @@ -134,4 +134,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/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/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/providers/nutrition.dart b/lib/providers/nutrition.dart index 1d0d2484..cf124e18 100644 --- a/lib/providers/nutrition.dart +++ b/lib/providers/nutrition.dart @@ -334,7 +334,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']; @@ -343,6 +343,18 @@ class NutritionPlansProvider extends WgerBaseProvider with ChangeNotifier { notifyListeners(); } + /// 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, dateTime); + + 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/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/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, ), /* 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); + }, + ), ], ), ], 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/forms.dart b/lib/widgets/nutrition/forms.dart index 0e449dc8..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,55 +115,28 @@ class MealForm extends StatelessWidget { class MealItemForm extends StatelessWidget { final Meal _meal; late final MealItem _mealItem; + final List _listMealItems; - MealItemForm(this._meal, [mealItem]) { + 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; return Container( 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), controller: _amountController, @@ -188,6 +161,7 @@ class MealItemForm extends StatelessWidget { return; } _form.currentState!.save(); + _mealItem.ingredientId = int.parse(_ingredientIdController.text); try { Provider.of(context, listen: false) @@ -200,6 +174,127 @@ class MealItemForm extends StatelessWidget { Navigator.of(context).pop(); }, ), + if (_listMealItems.isNotEmpty) const SizedBox(height: 10.0), + Container( + child: Text(AppLocalizations.of(context).recentlyUsedIngredients), + 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; + _ingredientIdController.text = + _listMealItems[index].ingredientObj.id.toString(); + _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), + ), + ); + }, + ), + ) + ], + ), + ), + ); + } +} + +class IngredientLogForm extends StatelessWidget { + late MealItem _mealItem; + 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: const EdgeInsets.all(20), + child: Form( + key: _form, + child: Column( + children: [ + IngredientTypeahead(_ingredientIdController, _ingredientController), + 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; + }, + ), + 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 { + if (!_form.currentState!.validate()) { + return; + } + _form.currentState!.save(); + _mealItem.ingredientId = int.parse(_ingredientIdController.text); + + try { + Provider.of(context, listen: false).logIngredentToDiary( + _mealItem, _plan.id!, DateTime.parse(_dateController.text)); + } on WgerHttpException catch (error) { + showHttpExceptionErrorDialog(error, context); + } catch (error) { + showErrorDialog(error, context); + } + Navigator.of(context).pop(); + }, + ), ], ), ), @@ -210,7 +305,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(); 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/meal.dart b/lib/widgets/nutrition/meal.dart index a7eb6bb4..432a52d1 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 _listMealItems; const MealWidget( this._meal, + this._listMealItems, ); @override @@ -127,7 +129,7 @@ class _MealWidgetState extends State { FormScreen.routeName, arguments: FormScreenArguments( AppLocalizations.of(context).addIngredient, - MealItemForm(widget._meal), + MealItemForm(widget._meal, widget._listMealItems), hasListView: true, ), ); 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 e0ebcd9a..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'; @@ -48,7 +48,9 @@ class NutritionalPlanDetailWidget extends StatelessWidget { delegate: SliverChildListDelegate( [ const SizedBox(height: 10), - ..._nutritionalPlan.meals.map((meal) => MealWidget(meal)).toList(), + ..._nutritionalPlan.meals + .map((meal) => MealWidget(meal, _nutritionalPlan.allMealItems)) + .toList(), Padding( padding: const EdgeInsets.all(8.0), child: ElevatedButton( 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/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( 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() { diff --git a/lib/widgets/workouts/forms.dart b/lib/widgets/workouts/forms.dart index d438efb7..d08a3000 100644 --- a/lib/widgets/workouts/forms.dart +++ b/lib/widgets/workouts/forms.dart @@ -740,8 +740,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; diff --git a/pubspec.lock b/pubspec.lock index 640d5ab0..07c538ba 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: @@ -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: @@ -105,14 +105,14 @@ packages: name: built_value url: "https://pub.dartlang.org" source: hosted - version: "8.1.2" + version: "8.1.3" camera: dependency: "direct main" description: 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: @@ -133,21 +140,21 @@ packages: name: charcode url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "1.3.1" charts_common: dependency: transitive description: 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: @@ -210,7 +217,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: @@ -353,7 +360,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 +391,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: @@ -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,14 +454,14 @@ 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: 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: @@ -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: @@ -524,14 +531,14 @@ packages: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.3.0" + version: "1.7.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: @@ -636,7 +643,7 @@ packages: name: petitparser url: "https://pub.dartlang.org" source: hosted - version: "4.1.0" + version: "4.4.0" platform: dependency: transitive description: @@ -664,7 +671,7 @@ packages: name: process url: "https://pub.dartlang.org" source: hosted - version: "4.2.3" + version: "4.2.4" provider: dependency: "direct main" description: @@ -685,7 +692,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,14 +706,14 @@ packages: name: rive url: "https://pub.dartlang.org" source: hosted - version: "0.7.32" + version: "0.7.33" shared_preferences: dependency: "direct main" description: name: shared_preferences url: "https://pub.dartlang.org" source: hosted - version: "2.0.7" + version: "2.0.8" shared_preferences_linux: dependency: transitive description: @@ -816,7 +823,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: @@ -830,7 +837,7 @@ packages: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.3.0" + version: "0.4.2" timing: dependency: transitive description: @@ -858,7 +865,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: @@ -914,7 +921,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: @@ -970,7 +977,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: @@ -984,14 +991,35 @@ 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: name: win32 url: "https://pub.dartlang.org" source: hosted - version: "2.2.9" + version: "2.2.10" xdg_directories: dependency: transitive description: @@ -1005,7 +1033,7 @@ packages: name: xml url: "https://pub.dartlang.org" source: hosted - version: "5.1.2" + version: "5.3.1" yaml: dependency: transitive description: @@ -1014,5 +1042,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 9c1f7b63..8c7b72a5 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 @@ -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 diff --git a/test/base_provider_test.mocks.dart b/test/base_provider_test.mocks.dart index 34fef390..c64ebdcf 100644 --- a/test/base_provider_test.mocks.dart +++ b/test/base_provider_test.mocks.dart @@ -22,8 +22,7 @@ import 'package:mockito/mockito.dart' as _i1; class _FakeResponse_0 extends _i1.Fake implements _i2.Response {} -class _FakeStreamedResponse_1 extends _i1.Fake implements _i3.StreamedResponse { -} +class _FakeStreamedResponse_1 extends _i1.Fake implements _i3.StreamedResponse {} /// A class which mocks [Client]. /// @@ -36,73 +35,51 @@ class MockClient extends _i1.Mock implements _i4.Client { @override _i5.Future<_i2.Response> head(Uri? url, {Map? headers}) => (super.noSuchMethod(Invocation.method(#head, [url], {#headers: headers}), - returnValue: Future<_i2.Response>.value(_FakeResponse_0())) - as _i5.Future<_i2.Response>); + returnValue: Future<_i2.Response>.value(_FakeResponse_0())) as _i5.Future<_i2.Response>); @override _i5.Future<_i2.Response> get(Uri? url, {Map? headers}) => (super.noSuchMethod(Invocation.method(#get, [url], {#headers: headers}), - returnValue: Future<_i2.Response>.value(_FakeResponse_0())) - as _i5.Future<_i2.Response>); + returnValue: Future<_i2.Response>.value(_FakeResponse_0())) as _i5.Future<_i2.Response>); @override _i5.Future<_i2.Response> post(Uri? url, - {Map? headers, - Object? body, - _i6.Encoding? encoding}) => + {Map? headers, Object? body, _i6.Encoding? encoding}) => (super.noSuchMethod( - Invocation.method(#post, [url], - {#headers: headers, #body: body, #encoding: encoding}), - returnValue: Future<_i2.Response>.value(_FakeResponse_0())) - as _i5.Future<_i2.Response>); + Invocation.method(#post, [url], {#headers: headers, #body: body, #encoding: encoding}), + returnValue: Future<_i2.Response>.value(_FakeResponse_0())) as _i5.Future<_i2.Response>); @override _i5.Future<_i2.Response> put(Uri? url, - {Map? headers, - Object? body, - _i6.Encoding? encoding}) => + {Map? headers, Object? body, _i6.Encoding? encoding}) => (super.noSuchMethod( - Invocation.method(#put, [url], - {#headers: headers, #body: body, #encoding: encoding}), - returnValue: Future<_i2.Response>.value(_FakeResponse_0())) - as _i5.Future<_i2.Response>); + Invocation.method(#put, [url], {#headers: headers, #body: body, #encoding: encoding}), + returnValue: Future<_i2.Response>.value(_FakeResponse_0())) as _i5.Future<_i2.Response>); @override _i5.Future<_i2.Response> patch(Uri? url, - {Map? headers, - Object? body, - _i6.Encoding? encoding}) => + {Map? headers, Object? body, _i6.Encoding? encoding}) => (super.noSuchMethod( - Invocation.method(#patch, [url], - {#headers: headers, #body: body, #encoding: encoding}), - returnValue: Future<_i2.Response>.value(_FakeResponse_0())) - as _i5.Future<_i2.Response>); + Invocation.method(#patch, [url], {#headers: headers, #body: body, #encoding: encoding}), + returnValue: Future<_i2.Response>.value(_FakeResponse_0())) as _i5.Future<_i2.Response>); @override _i5.Future<_i2.Response> delete(Uri? url, - {Map? headers, - Object? body, - _i6.Encoding? encoding}) => + {Map? headers, Object? body, _i6.Encoding? encoding}) => (super.noSuchMethod( - Invocation.method(#delete, [url], - {#headers: headers, #body: body, #encoding: encoding}), - returnValue: Future<_i2.Response>.value(_FakeResponse_0())) - as _i5.Future<_i2.Response>); + Invocation.method(#delete, [url], {#headers: headers, #body: body, #encoding: encoding}), + returnValue: Future<_i2.Response>.value(_FakeResponse_0())) as _i5.Future<_i2.Response>); @override _i5.Future read(Uri? url, {Map? headers}) => (super.noSuchMethod(Invocation.method(#read, [url], {#headers: headers}), returnValue: Future.value('')) as _i5.Future); @override - _i5.Future<_i7.Uint8List> readBytes(Uri? url, - {Map? headers}) => - (super.noSuchMethod( - Invocation.method(#readBytes, [url], {#headers: headers}), - returnValue: Future<_i7.Uint8List>.value(_i7.Uint8List(0))) - as _i5.Future<_i7.Uint8List>); + _i5.Future<_i7.Uint8List> readBytes(Uri? url, {Map? headers}) => + (super.noSuchMethod(Invocation.method(#readBytes, [url], {#headers: headers}), + returnValue: Future<_i7.Uint8List>.value(_i7.Uint8List(0))) as _i5.Future<_i7.Uint8List>); @override _i5.Future<_i3.StreamedResponse> send(_i8.BaseRequest? request) => (super.noSuchMethod(Invocation.method(#send, [request]), - returnValue: - Future<_i3.StreamedResponse>.value(_FakeStreamedResponse_1())) + returnValue: Future<_i3.StreamedResponse>.value(_FakeStreamedResponse_1())) as _i5.Future<_i3.StreamedResponse>); @override - void close() => super.noSuchMethod(Invocation.method(#close, []), - returnValueForMissingStub: null); + 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 599b58c8..b7864a90 100644 --- a/test/gallery_screen_test.mocks.dart +++ b/test/gallery_screen_test.mocks.dart @@ -37,30 +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); @override _i6.Future fetchAndSetGallery() => (super.noSuchMethod(Invocation.method(#fetchAndSetGallery, []), @@ -82,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/measurements/measurement_provider_test.mocks.dart b/test/measurements/measurement_provider_test.mocks.dart index 279715bb..3d0ae4e9 100644 --- a/test/measurements/measurement_provider_test.mocks.dart +++ b/test/measurements/measurement_provider_test.mocks.dart @@ -34,49 +34,43 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { } @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 - 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 - _i5.Future> fetch(Uri? uri) => (super.noSuchMethod( - Invocation.method(#fetch, [uri]), - returnValue: Future>.value({})) - as _i5.Future>); + _i5.Future> fetch(Uri? uri) => + (super.noSuchMethod(Invocation.method(#fetch, [uri]), + returnValue: Future>.value({})) + as _i5.Future>); @override _i5.Future> post(Map? data, Uri? uri) => (super.noSuchMethod(Invocation.method(#post, [data, uri]), - returnValue: - Future>.value({})) + returnValue: Future>.value({})) as _i5.Future>); @override - _i5.Future> patch( - Map? data, Uri? uri) => + _i5.Future> patch(Map? data, Uri? uri) => (super.noSuchMethod(Invocation.method(#patch, [data, uri]), - returnValue: - Future>.value({})) + returnValue: Future>.value({})) as _i5.Future>); @override _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>); + 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 7558ddf1..a878141a 100644 --- a/test/nutritional_plan_form_test.mocks.dart +++ b/test/nutritional_plan_form_test.mocks.dart @@ -41,38 +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); @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,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) => @@ -110,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]), @@ -151,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]), @@ -173,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/nutritional_plan_model_test.dart b/test/nutritional_plan_model_test.dart index 3ff9d69a..e2e12746 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/nutritrional_values.dart'; +import 'package:wger/models/nutrition/nutritional_plan.dart'; +import 'package:wger/models/nutrition/nutritional_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); + }); }); } 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(); diff --git a/test/workout_form_test.mocks.dart b/test/workout_form_test.mocks.dart index 12a1f750..9bfd1d08 100644 --- a/test/workout_form_test.mocks.dart +++ b/test/workout_form_test.mocks.dart @@ -54,76 +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); @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]), @@ -131,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 @@ -143,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, []), @@ -233,60 +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 - Uri makeUrl(String? path, - {int? id, String? objectMethod, Map? query}) => + _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(#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 6b47346d..b6cef929 100644 --- a/test/workout_set_form_test.mocks.dart +++ b/test/workout_set_form_test.mocks.dart @@ -2,18 +2,14 @@ // in wger/test/workout_set_form_test.dart. // Do not manually edit this file. -import 'dart:async' as _i9; -import 'dart:ui' as _i11; +import 'dart:async' as _i6; +import 'dart:ui' as _i7; +import 'package:http/http.dart' as _i3; import 'package:mockito/mockito.dart' as _i1; -import 'package:wger/models/exercises/base.dart' as _i10; -import 'package:wger/models/exercises/category.dart' as _i4; -import 'package:wger/models/exercises/equipment.dart' as _i5; -import 'package:wger/models/exercises/exercise.dart' as _i3; -import 'package:wger/models/exercises/language.dart' as _i7; -import 'package:wger/models/exercises/muscle.dart' as _i6; -import 'package:wger/providers/base_provider.dart' as _i2; -import 'package:wger/providers/exercises.dart' as _i8; +import 'package:wger/models/exercises/exercise.dart' as _i4; +import 'package:wger/providers/auth.dart' as _i2; +import 'package:wger/providers/exercises.dart' as _i5; // ignore_for_file: avoid_redundant_argument_values // ignore_for_file: avoid_setters_without_getters @@ -23,164 +19,114 @@ import 'package:wger/providers/exercises.dart' as _i8; // ignore_for_file: prefer_const_constructors // ignore_for_file: unnecessary_parenthesis -class _FakeWgerBaseProvider_0 extends _i1.Fake implements _i2.WgerBaseProvider { -} +class _FakeAuthProvider_0 extends _i1.Fake implements _i2.AuthProvider {} -class _FakeExercise_1 extends _i1.Fake implements _i3.Exercise {} +class _FakeClient_1 extends _i1.Fake implements _i3.Client {} -class _FakeExerciseCategory_2 extends _i1.Fake implements _i4.ExerciseCategory { -} +class _FakeExercise_2 extends _i1.Fake implements _i4.Exercise {} -class _FakeEquipment_3 extends _i1.Fake implements _i5.Equipment {} +class _FakeUri_3 extends _i1.Fake implements Uri {} -class _FakeMuscle_4 extends _i1.Fake implements _i6.Muscle {} - -class _FakeLanguage_5 extends _i1.Fake implements _i7.Language {} +class _FakeResponse_4 extends _i1.Fake implements _i3.Response {} /// A class which mocks [ExercisesProvider]. /// /// See the documentation for Mockito's code generation for more information. -class MockExercisesProvider extends _i1.Mock implements _i8.ExercisesProvider { +class MockExercisesProvider extends _i1.Mock implements _i5.ExercisesProvider { MockExercisesProvider() { _i1.throwOnMissingStub(this); } @override - _i2.WgerBaseProvider get baseProvider => - (super.noSuchMethod(Invocation.getter(#baseProvider), - returnValue: _FakeWgerBaseProvider_0()) as _i2.WgerBaseProvider); + List<_i4.Exercise> get items => + (super.noSuchMethod(Invocation.getter(#items), returnValue: <_i4.Exercise>[]) + as List<_i4.Exercise>); @override - set exercises(List<_i3.Exercise>? exercises) => - super.noSuchMethod(Invocation.setter(#exercises, exercises), - returnValueForMissingStub: null); + _i2.AuthProvider get auth => + (super.noSuchMethod(Invocation.getter(#auth), returnValue: _FakeAuthProvider_0()) + as _i2.AuthProvider); @override - set filteredExercises(List<_i3.Exercise>? newfilteredExercises) => super - .noSuchMethod(Invocation.setter(#filteredExercises, newfilteredExercises), - returnValueForMissingStub: null); + set auth(_i2.AuthProvider? _auth) => + super.noSuchMethod(Invocation.setter(#auth, _auth), returnValueForMissingStub: null); @override - List<_i3.Exercise> get items => (super.noSuchMethod(Invocation.getter(#items), - returnValue: <_i3.Exercise>[]) as List<_i3.Exercise>); + _i3.Client get client => + (super.noSuchMethod(Invocation.getter(#client), returnValue: _FakeClient_1()) as _i3.Client); @override - List<_i4.ExerciseCategory> get categories => - (super.noSuchMethod(Invocation.getter(#categories), - returnValue: <_i4.ExerciseCategory>[]) as List<_i4.ExerciseCategory>); + set client(_i3.Client? _client) => + 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 - _i9.Future setFilters(_i8.Filters? newFilters) => - (super.noSuchMethod(Invocation.method(#setFilters, [newFilters]), - returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i9.Future); + _i4.Exercise findById(int? exerciseId) => (super + .noSuchMethod(Invocation.method(#findById, [exerciseId]), returnValue: _FakeExercise_2()) + as _i4.Exercise); @override - _i9.Future findByFilters() => - (super.noSuchMethod(Invocation.method(#findByFilters, []), - returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i9.Future); - @override - List<_i3.Exercise> findByCategory(_i4.ExerciseCategory? category) => - (super.noSuchMethod(Invocation.method(#findByCategory, [category]), - returnValue: <_i3.Exercise>[]) as List<_i3.Exercise>); - @override - _i3.Exercise findExerciseById(int? id) => - (super.noSuchMethod(Invocation.method(#findExerciseById, [id]), - returnValue: _FakeExercise_1()) as _i3.Exercise); - @override - _i4.ExerciseCategory findCategoryById(int? id) => - (super.noSuchMethod(Invocation.method(#findCategoryById, [id]), - returnValue: _FakeExerciseCategory_2()) as _i4.ExerciseCategory); - @override - _i5.Equipment findEquipmentById(int? id) => - (super.noSuchMethod(Invocation.method(#findEquipmentById, [id]), - returnValue: _FakeEquipment_3()) as _i5.Equipment); - @override - _i6.Muscle findMuscleById(int? id) => - (super.noSuchMethod(Invocation.method(#findMuscleById, [id]), - returnValue: _FakeMuscle_4()) as _i6.Muscle); - @override - _i7.Language findLanguageById(int? id) => - (super.noSuchMethod(Invocation.method(#findLanguageById, [id]), - returnValue: _FakeLanguage_5()) as _i7.Language); - @override - _i9.Future fetchAndSetCategories() => + _i6.Future fetchAndSetCategories() => (super.noSuchMethod(Invocation.method(#fetchAndSetCategories, []), returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i9.Future); + returnValueForMissingStub: Future.value()) as _i6.Future); @override - _i9.Future fetchAndSetMuscles() => + _i6.Future fetchAndSetMuscles() => (super.noSuchMethod(Invocation.method(#fetchAndSetMuscles, []), returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i9.Future); + returnValueForMissingStub: Future.value()) as _i6.Future); @override - _i9.Future fetchAndSetEquipment() => + _i6.Future fetchAndSetEquipment() => (super.noSuchMethod(Invocation.method(#fetchAndSetEquipment, []), returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i9.Future); + returnValueForMissingStub: Future.value()) as _i6.Future); @override - _i9.Future fetchAndSetLanguages() => - (super.noSuchMethod(Invocation.method(#fetchAndSetLanguages, []), - returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i9.Future); - @override - _i9.Future<_i3.Exercise> fetchAndSetExercise(int? exerciseId) => + _i6.Future<_i4.Exercise> fetchAndSetExercise(int? exerciseId) => (super.noSuchMethod(Invocation.method(#fetchAndSetExercise, [exerciseId]), - returnValue: Future<_i3.Exercise>.value(_FakeExercise_1())) - as _i9.Future<_i3.Exercise>); + returnValue: Future<_i4.Exercise>.value(_FakeExercise_2())) as _i6.Future<_i4.Exercise>); @override - List<_i10.ExerciseBase> mapImages( - dynamic data, List<_i10.ExerciseBase>? bases) => - (super.noSuchMethod(Invocation.method(#mapImages, [data, bases]), - returnValue: <_i10.ExerciseBase>[]) as List<_i10.ExerciseBase>); - @override - List<_i10.ExerciseBase> setBaseData( - dynamic data, List<_i3.Exercise>? exercises) => - (super.noSuchMethod(Invocation.method(#setBaseData, [data, exercises]), - returnValue: <_i10.ExerciseBase>[]) as List<_i10.ExerciseBase>); - @override - List mapBases( - List<_i10.ExerciseBase>? bases, List<_i3.Exercise>? exercises) => - (super.noSuchMethod(Invocation.method(#mapBases, [bases, exercises]), - returnValue: []) as List); - @override - List<_i3.Exercise> mapLanguages(List<_i3.Exercise>? exercises) => - (super.noSuchMethod(Invocation.method(#mapLanguages, [exercises]), - returnValue: <_i3.Exercise>[]) as List<_i3.Exercise>); - @override - List<_i3.Exercise> mapAliases(dynamic data, List<_i3.Exercise>? exercises) => - (super.noSuchMethod(Invocation.method(#mapAliases, [data, exercises]), - returnValue: <_i3.Exercise>[]) as List<_i3.Exercise>); - @override - List<_i3.Exercise> mapComments(dynamic data, List<_i3.Exercise>? exercises) => - (super.noSuchMethod(Invocation.method(#mapComments, [data, exercises]), - returnValue: <_i3.Exercise>[]) as List<_i3.Exercise>); - @override - _i9.Future fetchAndSetExercises() => + _i6.Future fetchAndSetExercises() => (super.noSuchMethod(Invocation.method(#fetchAndSetExercises, []), returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i9.Future); + returnValueForMissingStub: Future.value()) as _i6.Future); @override - _i9.Future> searchExercise(String? name, - [String? languageCode = r'en']) => + _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}) => (super.noSuchMethod( - Invocation.method(#searchExercise, [name, languageCode]), - returnValue: Future>.value(<_i3.Exercise>[])) - as _i9.Future>); + 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>); + @override + _i6.Future> post(Map? data, Uri? uri) => + (super.noSuchMethod(Invocation.method(#post, [data, uri]), + returnValue: Future>.value({})) + as _i6.Future>); + @override + _i6.Future> patch(Map? data, Uri? uri) => + (super.noSuchMethod(Invocation.method(#patch, [data, uri]), + 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>); @override String toString() => super.toString(); @override - void addListener(_i11.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(_i11.VoidCallback? listener) => + 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_data/nutritional_plans.dart b/test_data/nutritional_plans.dart index b38573ce..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, 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; }