diff --git a/assets/svg/cancel.svg b/assets/svg/cancel.svg new file mode 100644 index 0000000..1cae72f --- /dev/null +++ b/assets/svg/cancel.svg @@ -0,0 +1,3 @@ + + + diff --git a/ios/Podfile.lock b/ios/Podfile.lock index b641993..9418f0e 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -48,4 +48,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: 70d9d25280d0dd177a5f637cdb0f0b0b12c6a189 -COCOAPODS: 1.12.1 +COCOAPODS: 1.15.2 diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist index 9a3bec3..20f5333 100644 --- a/ios/Runner/Info.plist +++ b/ios/Runner/Info.plist @@ -6,6 +6,11 @@ $(DEVELOPMENT_LANGUAGE) CFBundleDisplayName Receipe App + CFBundleLocalizations + + en + fr + CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier diff --git a/lib/app/app.dart b/lib/app/app.dart index f8c7b45..005b36e 100644 --- a/lib/app/app.dart +++ b/lib/app/app.dart @@ -21,6 +21,7 @@ import 'package:receipe_app/services/dish_service.dart'; import 'package:receipe_app/services/database_service.dart'; import 'package:receipe_app/services/user_service.dart'; import 'package:receipe_app/ui/views/single_user/single_user_view.dart'; +import 'package:receipe_app/services/localization_service.dart'; // @stacked-import @StackedApp( @@ -41,6 +42,7 @@ import 'package:receipe_app/ui/views/single_user/single_user_view.dart'; LazySingleton(classType: BottomSheetService), LazySingleton(classType: DialogService), LazySingleton(classType: NavigationService), + LazySingleton(classType: SnackbarService), LazySingleton(classType: EventService), LazySingleton(classType: SecureStorageService), LazySingleton(classType: DioService), @@ -49,6 +51,7 @@ import 'package:receipe_app/ui/views/single_user/single_user_view.dart'; LazySingleton(classType: DatabaseMigrationService), InitializableSingleton(classType: DatabaseService), LazySingleton(classType: UserService), + LazySingleton(classType: LocalizationService), // @stacked-service ], bottomsheets: [ diff --git a/lib/app/app.locator.dart b/lib/app/app.locator.dart index d6fa87c..9d0ce69 100644 --- a/lib/app/app.locator.dart +++ b/lib/app/app.locator.dart @@ -10,6 +10,7 @@ import 'package:sqflite_migration_service/src/database_migration_service.dart'; import 'package:stacked_services/src/bottom_sheet/bottom_sheet_service.dart'; import 'package:stacked_services/src/dialog/dialog_service.dart'; import 'package:stacked_services/src/navigation/navigation_service.dart'; +import 'package:stacked_services/src/snackbar/snackbar_service.dart'; import 'package:stacked_shared/stacked_shared.dart'; import '../services/authentication_service.dart'; @@ -17,6 +18,7 @@ import '../services/database_service.dart'; import '../services/dio_service.dart'; import '../services/dish_service.dart'; import '../services/event_service.dart'; +import '../services/localization_service.dart'; import '../services/secure_storage_service.dart'; import '../services/user_service.dart'; @@ -34,6 +36,7 @@ Future setupLocator({ locator.registerLazySingleton(() => BottomSheetService()); locator.registerLazySingleton(() => DialogService()); locator.registerLazySingleton(() => NavigationService()); + locator.registerLazySingleton(() => SnackbarService()); locator.registerLazySingleton(() => EventService()); locator.registerLazySingleton(() => SecureStorageService()); locator.registerLazySingleton(() => DioService()); @@ -45,4 +48,5 @@ Future setupLocator({ locator.registerSingleton(databaseService); locator.registerLazySingleton(() => UserService()); + locator.registerLazySingleton(() => LocalizationService()); } diff --git a/lib/enums/languages.dart b/lib/enums/languages.dart new file mode 100644 index 0000000..d04cfd1 --- /dev/null +++ b/lib/enums/languages.dart @@ -0,0 +1 @@ +enum Languages { english, french } diff --git a/lib/enums/snackbar_type.dart b/lib/enums/snackbar_type.dart new file mode 100644 index 0000000..c541820 --- /dev/null +++ b/lib/enums/snackbar_type.dart @@ -0,0 +1,3 @@ +enum SnackbarType { + custom, +} diff --git a/lib/generated/intl/messages_all.dart b/lib/generated/intl/messages_all.dart index 203415c..f9e94e5 100644 --- a/lib/generated/intl/messages_all.dart +++ b/lib/generated/intl/messages_all.dart @@ -17,16 +17,20 @@ import 'package:intl/message_lookup_by_library.dart'; import 'package:intl/src/intl_helpers.dart'; import 'messages_en.dart' as messages_en; +import 'messages_fr.dart' as messages_fr; typedef Future LibraryLoader(); Map _deferredLibraries = { 'en': () => new SynchronousFuture(null), + 'fr': () => new SynchronousFuture(null), }; MessageLookupByLibrary? _findExact(String localeName) { switch (localeName) { case 'en': return messages_en.messages; + case 'fr': + return messages_fr.messages; default: return null; } diff --git a/lib/generated/intl/messages_en.dart b/lib/generated/intl/messages_en.dart index 92d6115..08e2291 100644 --- a/lib/generated/intl/messages_en.dart +++ b/lib/generated/intl/messages_en.dart @@ -57,7 +57,11 @@ class MessageLookup extends MessageLookupByLibrary { MessageLookupByLibrary.simpleMessage("Enter your last name"), "enter_your_password": MessageLookupByLibrary.simpleMessage("Enter your password"), + "field_required": + MessageLookupByLibrary.simpleMessage("Field is required"), "first_name": MessageLookupByLibrary.simpleMessage("First Name"), + "first_name_required": + MessageLookupByLibrary.simpleMessage("First name is required"), "generate_recipe_contents": MessageLookupByLibrary.simpleMessage("Generating Recipe contents"), "get_started": MessageLookupByLibrary.simpleMessage("Get Started"), @@ -70,7 +74,11 @@ class MessageLookup extends MessageLookupByLibrary { "instructions": MessageLookupByLibrary.simpleMessage("Instructions"), "kindly_edit": MessageLookupByLibrary.simpleMessage( "Kindly edit the details below to the reflect the right standard dish information"), + "kindly_fill_form": MessageLookupByLibrary.simpleMessage( + "Kindly fill the form to create a Kally Dish account"), "last_name": MessageLookupByLibrary.simpleMessage("Last name"), + "last_name_required": + MessageLookupByLibrary.simpleMessage("Last name is required"), "login": MessageLookupByLibrary.simpleMessage("Login"), "logout": MessageLookupByLibrary.simpleMessage("LOGOUT "), "my_dish": MessageLookupByLibrary.simpleMessage("MY DISH"), @@ -94,9 +102,19 @@ class MessageLookup extends MessageLookupByLibrary { "onboarding_title_two": MessageLookupByLibrary.simpleMessage("Seamless Order"), "password": MessageLookupByLibrary.simpleMessage("Password"), + "password_required": + MessageLookupByLibrary.simpleMessage("Password Required"), + "password_too_short": + MessageLookupByLibrary.simpleMessage("Password is too short"), + "phone_number": MessageLookupByLibrary.simpleMessage("Phone Number"), + "phone_number_empty": MessageLookupByLibrary.simpleMessage( + "Phone Number cannot be empty"), + "phone_number_invalid": + MessageLookupByLibrary.simpleMessage("The phone number is invalid"), + "phone_number_not_complete": + MessageLookupByLibrary.simpleMessage("Phone number not complete"), "please_sign_in_to_continue": MessageLookupByLibrary.simpleMessage("Please sign in to continue"), - "required": MessageLookupByLibrary.simpleMessage("Required"), "service_unavailable": MessageLookupByLibrary.simpleMessage("Service Unavailable"), "sign_up": MessageLookupByLibrary.simpleMessage("Sign Up"), diff --git a/lib/generated/intl/messages_fr.dart b/lib/generated/intl/messages_fr.dart new file mode 100644 index 0000000..96f964b --- /dev/null +++ b/lib/generated/intl/messages_fr.dart @@ -0,0 +1,128 @@ +// DO NOT EDIT. This is code generated via package:intl/generate_localized.dart +// This is a library that provides messages for a fr locale. All the +// messages from the main program should be duplicated here with the same +// function name. + +// Ignore issues from commonly used lints in this file. +// ignore_for_file:unnecessary_brace_in_string_interps, unnecessary_new +// ignore_for_file:prefer_single_quotes,comment_references, directives_ordering +// ignore_for_file:annotate_overrides,prefer_generic_function_type_aliases +// ignore_for_file:unused_import, file_names, avoid_escaping_inner_quotes +// ignore_for_file:unnecessary_string_interpolations, unnecessary_string_escapes + +import 'package:intl/intl.dart'; +import 'package:intl/message_lookup_by_library.dart'; + +final messages = new MessageLookup(); + +typedef String MessageIfAbsent(String messageStr, List args); + +class MessageLookup extends MessageLookupByLibrary { + String get localeName => 'fr'; + + final messages = _notInlinedMessages(_notInlinedMessages); + static Map _notInlinedMessages(_) => { + "already_have_an_account": + MessageLookupByLibrary.simpleMessage("Vous avez déjà un compte ?"), + "are_you_sure": MessageLookupByLibrary.simpleMessage( + "Êtes-vous sûr de vouloir supprimer ce plat ?"), + "cancel": MessageLookupByLibrary.simpleMessage("Annuler"), + "click_done": MessageLookupByLibrary.simpleMessage( + "Cliquez sur \"Terminé\" après votre saisie."), + "connection_error": MessageLookupByLibrary.simpleMessage( + "Il semble que nous ayons un problème de connexion au serveur. Veuillez réessayer lorsque vous aurez un réseau plus fort"), + "connection_timeout": MessageLookupByLibrary.simpleMessage( + "Pas de connexion Internet. Il semble que la connexion ait expiré"), + "create_a_dish": MessageLookupByLibrary.simpleMessage("Créer un plat"), + "create_a_dish_intro": MessageLookupByLibrary.simpleMessage( + "Salut😚, Il est temps de créer ce plat spécial que vous avez toujours désiré.\nVeuillez remplir les détails ci-dessous"), + "create_dish": MessageLookupByLibrary.simpleMessage("Créer un plat"), + "dark_mode": MessageLookupByLibrary.simpleMessage("MODE SOMBRE"), + "date_created": + MessageLookupByLibrary.simpleMessage("Date de création : "), + "delete_dish": + MessageLookupByLibrary.simpleMessage("Supprimer le plat"), + "dont_have_an_account": MessageLookupByLibrary.simpleMessage( + "Vous n\'avez pas de compte ?"), + "drawer_home": MessageLookupByLibrary.simpleMessage("ACCUEIL"), + "edit_dish": MessageLookupByLibrary.simpleMessage("Modifier le plat"), + "email_address": MessageLookupByLibrary.simpleMessage("Adresse e-mail"), + "email_cannot_be_empty": MessageLookupByLibrary.simpleMessage( + "L\'e-mail ne peut pas être vide"), + "email_must_be_a_valid_email": MessageLookupByLibrary.simpleMessage( + "L\'e-mail doit être une adresse e-mail valide"), + "enter_your_email": + MessageLookupByLibrary.simpleMessage("Entrez votre adresse e-mail"), + "enter_your_first_name": + MessageLookupByLibrary.simpleMessage("Entrez votre prénom"), + "enter_your_last_name": + MessageLookupByLibrary.simpleMessage("Entrez votre nom de famille"), + "enter_your_password": + MessageLookupByLibrary.simpleMessage("Entrez votre mot de passe"), + "field_required": MessageLookupByLibrary.simpleMessage("Champ requis"), + "first_name": MessageLookupByLibrary.simpleMessage("Prénom"), + "first_name_required": + MessageLookupByLibrary.simpleMessage("Prénom requis"), + "generate_recipe_contents": MessageLookupByLibrary.simpleMessage( + "Génération du contenu de la recette"), + "get_started": MessageLookupByLibrary.simpleMessage("Commencer"), + "hello_word": MessageLookupByLibrary.simpleMessage("Bonjour le Monde"), + "hi": MessageLookupByLibrary.simpleMessage("Salut"), + "home": MessageLookupByLibrary.simpleMessage("Accueil"), + "ingredient_of_dish": + MessageLookupByLibrary.simpleMessage("Ingrédients du plat"), + "ingredients": MessageLookupByLibrary.simpleMessage("Ingrédients"), + "instructions": MessageLookupByLibrary.simpleMessage("Instructions"), + "kindly_edit": MessageLookupByLibrary.simpleMessage( + "Veuillez modifier les détails ci-dessous pour refléter les informations correctes sur le plat standard"), + "kindly_fill_form": MessageLookupByLibrary.simpleMessage( + "Veuillez remplir le formulaire pour créer un compte Kally Dish"), + "last_name": MessageLookupByLibrary.simpleMessage("Nom de famille"), + "last_name_required": + MessageLookupByLibrary.simpleMessage("Nom de famille requis"), + "login": MessageLookupByLibrary.simpleMessage("Connexion"), + "logout": MessageLookupByLibrary.simpleMessage("DÉCONNEXION"), + "my_dish": MessageLookupByLibrary.simpleMessage("MON PLAT"), + "mydish": MessageLookupByLibrary.simpleMessage("Mon Plat"), + "name": MessageLookupByLibrary.simpleMessage("Nom : "), + "name_of_dish": MessageLookupByLibrary.simpleMessage("Nom du plat"), + "no_dish_available": MessageLookupByLibrary.simpleMessage( + "Il n\'y a actuellement aucun plat disponible à visualiser"), + "no_internet": MessageLookupByLibrary.simpleMessage( + "Pas de connexion Internet. Veuillez réessayer plus tard"), + "onboarding_subtitle_one": MessageLookupByLibrary.simpleMessage( + "Kally Dish propose des denrées alimentaires non périssables au prix de gros le plus bas, livrées gratuitement à votre porte"), + "onboarding_subtitle_three": MessageLookupByLibrary.simpleMessage( + "Kally Dish offre un accès exclusif à des avantages économiques, gain de temps et réduction de stress grâce à son plan d\'adhésion"), + "onboarding_subtitle_two": MessageLookupByLibrary.simpleMessage( + "Avec Kally Dish, vous pouvez passer votre commande depuis le confort de votre domicile en appelant l\'un de nos numéros d\'assistance"), + "onboarding_title_one": MessageLookupByLibrary.simpleMessage( + "Livraison gratuite de qualité"), + "onboarding_title_three": MessageLookupByLibrary.simpleMessage( + "Abonnez-vous à notre magasin"), + "onboarding_title_two": + MessageLookupByLibrary.simpleMessage("Commande sans faille"), + "password": MessageLookupByLibrary.simpleMessage("Mot de passe"), + "password_required": + MessageLookupByLibrary.simpleMessage("Mot de passe requis"), + "password_too_short": + MessageLookupByLibrary.simpleMessage("Mot de passe trop court"), + "phone_number": + MessageLookupByLibrary.simpleMessage("Numéro de téléphone"), + "phone_number_empty": MessageLookupByLibrary.simpleMessage( + "Le numéro de téléphone ne peut pas être vide"), + "phone_number_invalid": MessageLookupByLibrary.simpleMessage( + "Le numéro de téléphone est invalide"), + "phone_number_not_complete": MessageLookupByLibrary.simpleMessage( + "Numéro de téléphone incomplet"), + "please_sign_in_to_continue": MessageLookupByLibrary.simpleMessage( + "Veuillez vous connecter pour continuer"), + "service_unavailable": + MessageLookupByLibrary.simpleMessage("Service indisponible"), + "sign_up": MessageLookupByLibrary.simpleMessage("S\'inscrire"), + "unknown_error": + MessageLookupByLibrary.simpleMessage("Erreur inconnue"), + "welcome": MessageLookupByLibrary.simpleMessage("Bienvenue"), + "yes": MessageLookupByLibrary.simpleMessage("Oui") + }; +} diff --git a/lib/generated/l10n.dart b/lib/generated/l10n.dart index 51e1e3a..bde33f6 100644 --- a/lib/generated/l10n.dart +++ b/lib/generated/l10n.dart @@ -300,11 +300,91 @@ class S { ); } - /// `Required` - String get required { + /// `Password Required` + String get password_required { return Intl.message( - 'Required', - name: 'required', + 'Password Required', + name: 'password_required', + desc: '', + args: [], + ); + } + + /// `Phone Number cannot be empty` + String get phone_number_empty { + return Intl.message( + 'Phone Number cannot be empty', + name: 'phone_number_empty', + desc: '', + args: [], + ); + } + + /// `Phone Number` + String get phone_number { + return Intl.message( + 'Phone Number', + name: 'phone_number', + desc: '', + args: [], + ); + } + + /// `Field is required` + String get field_required { + return Intl.message( + 'Field is required', + name: 'field_required', + desc: '', + args: [], + ); + } + + /// `Phone number not complete` + String get phone_number_not_complete { + return Intl.message( + 'Phone number not complete', + name: 'phone_number_not_complete', + desc: '', + args: [], + ); + } + + /// `Password is too short` + String get password_too_short { + return Intl.message( + 'Password is too short', + name: 'password_too_short', + desc: '', + args: [], + ); + } + + /// `First name is required` + String get first_name_required { + return Intl.message( + 'First name is required', + name: 'first_name_required', + desc: '', + args: [], + ); + } + + /// `Last name is required` + String get last_name_required { + return Intl.message( + 'Last name is required', + name: 'last_name_required', + desc: '', + args: [], + ); + } + + /// `The phone number is invalid` + String get phone_number_invalid { + return Intl.message( + 'The phone number is invalid', + name: 'phone_number_invalid', desc: '', args: [], ); @@ -320,6 +400,16 @@ class S { ); } + /// `Kindly fill the form to create a Kally Dish account` + String get kindly_fill_form { + return Intl.message( + 'Kindly fill the form to create a Kally Dish account', + name: 'kindly_fill_form', + desc: '', + args: [], + ); + } + /// `Edit Dish` String get edit_dish { return Intl.message( @@ -607,6 +697,7 @@ class AppLocalizationDelegate extends LocalizationsDelegate { List get supportedLocales { return const [ Locale.fromSubtags(languageCode: 'en'), + Locale.fromSubtags(languageCode: 'fr'), ]; } diff --git a/lib/l10n/intl_en.arb b/lib/l10n/intl_en.arb index 4ba7964..7c4d6ed 100644 --- a/lib/l10n/intl_en.arb +++ b/lib/l10n/intl_en.arb @@ -25,8 +25,17 @@ "sign_up": "Sign Up", "email_cannot_be_empty": "Email cannot be empty", "email_must_be_a_valid_email": "Email must be a valid email address", - "required": "Required", + "password_required": "Password Required", + "phone_number_empty": "Phone Number cannot be empty", + "phone_number": "Phone Number", + "field_required": "Field is required", + "phone_number_not_complete": "Phone number not complete", + "password_too_short": "Password is too short", + "first_name_required": "First name is required", + "last_name_required": "Last name is required", + "phone_number_invalid": "The phone number is invalid", "kindly_edit": "Kindly edit the details below to the reflect the right standard dish information", + "kindly_fill_form": "Kindly fill the form to create a Kally Dish account", "edit_dish": "Edit Dish", "name_of_dish": "Name of Dish", "instructions": "Instructions", diff --git a/lib/l10n/intl_fr.arb b/lib/l10n/intl_fr.arb new file mode 100644 index 0000000..4abe74a --- /dev/null +++ b/lib/l10n/intl_fr.arb @@ -0,0 +1,67 @@ +{ + "@@locale": "fr", + "hello_word": "Bonjour le Monde", + "get_started": "Commencer", + "onboarding_title_one": "Livraison gratuite de qualité", + "onboarding_subtitle_one": "Kally Dish propose des denrées alimentaires non périssables au prix de gros le plus bas, livrées gratuitement à votre porte", + "onboarding_title_two": "Commande sans faille", + "onboarding_subtitle_two": "Avec Kally Dish, vous pouvez passer votre commande depuis le confort de votre domicile en appelant l'un de nos numéros d'assistance", + "onboarding_title_three": "Abonnez-vous à notre magasin", + "onboarding_subtitle_three": "Kally Dish offre un accès exclusif à des avantages économiques, gain de temps et réduction de stress grâce à son plan d'adhésion", + "welcome": "Bienvenue", + "mydish": "Mon Plat", + "please_sign_in_to_continue": "Veuillez vous connecter pour continuer", + "email_address": "Adresse e-mail", + "enter_your_email": "Entrez votre adresse e-mail", + "password": "Mot de passe", + "enter_your_password": "Entrez votre mot de passe", + "first_name": "Prénom", + "enter_your_first_name": "Entrez votre prénom", + "last_name": "Nom de famille", + "enter_your_last_name": "Entrez votre nom de famille", + "login": "Connexion", + "dont_have_an_account": "Vous n'avez pas de compte ?", + "already_have_an_account": "Vous avez déjà un compte ?", + "sign_up": "S'inscrire", + "email_cannot_be_empty": "L'e-mail ne peut pas être vide", + "email_must_be_a_valid_email": "L'e-mail doit être une adresse e-mail valide", + "password_required": "Mot de passe requis", + "phone_number_empty": "Le numéro de téléphone ne peut pas être vide", + "phone_number": "Numéro de téléphone", + "field_required": "Champ requis", + "phone_number_not_complete": "Numéro de téléphone incomplet", + "password_too_short": "Mot de passe trop court", + "first_name_required": "Prénom requis", + "last_name_required": "Nom de famille requis", + "phone_number_invalid": "Le numéro de téléphone est invalide", + "kindly_edit": "Veuillez modifier les détails ci-dessous pour refléter les informations correctes sur le plat standard", + "kindly_fill_form": "Veuillez remplir le formulaire pour créer un compte Kally Dish", + "edit_dish": "Modifier le plat", + "name_of_dish": "Nom du plat", + "instructions": "Instructions", + "ingredients": "Ingrédients", + "click_done": "Cliquez sur \"Terminé\" après votre saisie.", + "name": "Nom : ", + "date_created": "Date de création : ", + "cancel": "Annuler", + "yes": "Oui", + "are_you_sure": "Êtes-vous sûr de vouloir supprimer ce plat ?", + "delete_dish": "Supprimer le plat", + "create_a_dish": "Créer un plat", + "create_a_dish_intro": "Salut😚, Il est temps de créer ce plat spécial que vous avez toujours désiré.\nVeuillez remplir les détails ci-dessous", + "ingredient_of_dish": "Ingrédients du plat", + "create_dish": "Créer un plat", + "no_internet": "Pas de connexion Internet. Veuillez réessayer plus tard", + "connection_timeout": "Pas de connexion Internet. Il semble que la connexion ait expiré", + "service_unavailable": "Service indisponible", + "unknown_error": "Erreur inconnue", + "home": "Accueil", + "drawer_home": "ACCUEIL", + "hi": "Salut", + "my_dish": "MON PLAT", + "dark_mode": "MODE SOMBRE", + "logout": "DÉCONNEXION", + "no_dish_available": "Il n'y a actuellement aucun plat disponible à visualiser", + "generate_recipe_contents": "Génération du contenu de la recette", + "connection_error": "Il semble que nous ayons un problème de connexion au serveur. Veuillez réessayer lorsque vous aurez un réseau plus fort" +} \ No newline at end of file diff --git a/lib/main.dart b/lib/main.dart index 5beb75f..ea7ac68 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -2,6 +2,8 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_localizations/flutter_localizations.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:receipe_app/services/localization_service.dart'; +import 'package:receipe_app/ui/snackbar/custom_snackbar.dart'; import 'package:stacked_services/stacked_services.dart'; import 'app/app.bottomsheets.dart'; import 'app/app.dialogs.dart'; @@ -16,6 +18,8 @@ Future main() async { await setupLocator(); setupDialogUi(); setupBottomSheetUi(); + setupAuthSnackbarUI(); + await S.load(const Locale.fromSubtags(languageCode: 'en')); runApp(const MainApp()); } @@ -37,6 +41,7 @@ class MainApp extends StatelessWidget { navigatorObservers: [ StackedService.routeObserver, ], + locale: LocalizationService().currentLocale, localizationsDelegates: const [ S.delegate, GlobalMaterialLocalizations.delegate, diff --git a/lib/services/localization_service.dart b/lib/services/localization_service.dart new file mode 100644 index 0000000..b112017 --- /dev/null +++ b/lib/services/localization_service.dart @@ -0,0 +1,18 @@ +import 'dart:ui'; + +import 'package:receipe_app/enums/languages.dart'; + +class LocalizationService { + //Hold current app locale + Locale _currentLocale = Locale.fromSubtags(languageCode: 'en'); + Locale get currentLocale => _currentLocale; + + //refactoring app-drawer VM localization + Languages _selectedLocale = Languages.english; + Languages get selectedLocale => _selectedLocale; + + //function to assign locale + void assignLocale(Languages value) { + _selectedLocale = value; + } +} diff --git a/lib/ui/common/app_colors.dart b/lib/ui/common/app_colors.dart index f0b3d83..07c9f78 100644 --- a/lib/ui/common/app_colors.dart +++ b/lib/ui/common/app_colors.dart @@ -21,6 +21,7 @@ class AppColors { static const Color primary11 = Color(0xFF331604); static const Color grey13 = Color(0xFFE8E8E8); static const Color redShade = Color(0xFFCC444B); + static const Color paleRed = Color(0xFFFFE3E0); static const Color popUpBg = Color(0xFFF5F5F5); static const Color orangeShade = Color(0xFFFFF3EC); static const Color barrierColor = Color(0x99454545); diff --git a/lib/ui/common/app_images.dart b/lib/ui/common/app_images.dart index 850fa4e..f15c500 100644 --- a/lib/ui/common/app_images.dart +++ b/lib/ui/common/app_images.dart @@ -15,6 +15,7 @@ class AppImages { static String likedIcon = 'assets/svg/heart_fil.svg'; static String unlikedIcon = 'assets/svg/heart.svg'; static String addcon = 'assets/svg/add.svg'; + static String cancel = 'assets/svg/cancel.svg'; static String lottie = 'assets/gif/lottie.svg'; static String home = "assets/svg/home.svg"; static String moon = "assets/svg/moon.svg"; diff --git a/lib/ui/snackbar/custom_snackbar.dart b/lib/ui/snackbar/custom_snackbar.dart new file mode 100644 index 0000000..748ac4e --- /dev/null +++ b/lib/ui/snackbar/custom_snackbar.dart @@ -0,0 +1,23 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_svg/svg.dart'; +import 'package:receipe_app/app/app.locator.dart'; +import 'package:receipe_app/enums/snackbar_type.dart'; +import 'package:receipe_app/ui/common/app_colors.dart'; +import 'package:receipe_app/ui/common/app_images.dart'; +import 'package:stacked_services/stacked_services.dart'; + +void setupAuthSnackbarUI() { + final snackbarService = locator(); + + snackbarService.registerCustomSnackbarConfig( + variant: SnackbarType.custom, + config: SnackbarConfig( + backgroundColor: AppColors.paleRed, + icon: SvgPicture.asset(AppImages.cancel), + borderRadius: 30, + margin: EdgeInsets.symmetric(horizontal: 20, vertical: 10), + textColor: AppColors.redShade, + snackPosition: SnackPosition.TOP, + ), + ); +} diff --git a/lib/ui/utilities/validation.dart b/lib/ui/utilities/validation.dart index 20ec71c..09b9657 100644 --- a/lib/ui/utilities/validation.dart +++ b/lib/ui/utilities/validation.dart @@ -14,9 +14,36 @@ class Validation { static String? validateField(String? s, {String? errorMessage}) { if (StringUtil.isEmpty(s)) { - return errorMessage ?? S.current.required; + return errorMessage ?? S.current.field_required; } else { return null; } } + + static String? validatePassword(String? s, {String? errorMessage}) { + if (StringUtil.isEmpty(s)) { + return errorMessage ?? S.current.password_required; + } else if (s!.length <= 3) { + return S.current.password_too_short; + } else { + return null; + } + } + + static String? validatePhoneNumber(String? phoneNumber) { + if (phoneNumber == null || phoneNumber.isEmpty) { + return S.current.phone_number_empty; + } + + try { + int phoneValue = int.parse(phoneNumber); + if (phoneNumber.length < 10) { + return S.current.phone_number_not_complete; + } + } catch (e) { + return S.current.phone_number_invalid; + } + + return null; + } } diff --git a/lib/ui/views/login/login_view.dart b/lib/ui/views/login/login_view.dart index ab1fc86..b323de1 100644 --- a/lib/ui/views/login/login_view.dart +++ b/lib/ui/views/login/login_view.dart @@ -76,20 +76,25 @@ class LoginView extends StackedView with $LoginView { focusNode: emailFocusNode, autofillHints: const [AutofillHints.email], keyboardType: TextInputType.emailAddress, - validator: Validation.validateEmail, + //validator: Validation.validateEmail, + validator: (value) { + return viewModel.loginEmailValidatorValue = + Validation.validateEmail(value); + }, decoration: InputDecoration( labelText: S.current.email_address, hintText: S.current.enter_your_email, ), ), - SizedBox( - height: 16.h, - ), + SizedBox(height: 16.h), TextFormField( controller: passwordController, focusNode: passwordFocusNode, obscureText: viewModel.hidePassword, - validator: Validation.validateField, + validator: (value) { + return viewModel.loginPasswordValidatorValue = + Validation.validatePassword(value); + }, decoration: InputDecoration( labelText: S.current.password, hintText: S.current.enter_your_password, @@ -112,7 +117,12 @@ class LoginView extends StackedView with $LoginView { PrimaryButton( buttonText: S.current.login, onTap: () { - if (_formKey.currentState?.validate() ?? false) { + if (_formKey.currentState?.validate() == false) { + viewModel.showLoginSnackBar( + viewModel.loginEmailValidatorValue ?? + viewModel.loginPasswordValidatorValue, + ); + } else { viewModel.login(); } }, diff --git a/lib/ui/views/login/login_viewmodel.dart b/lib/ui/views/login/login_viewmodel.dart index 7393645..39d200c 100644 --- a/lib/ui/views/login/login_viewmodel.dart +++ b/lib/ui/views/login/login_viewmodel.dart @@ -3,7 +3,9 @@ import 'package:receipe_app/app/app.logger.dart'; import 'package:receipe_app/app/app.router.dart'; import 'package:receipe_app/data_model/login_model.dart'; import 'package:receipe_app/data_model/login_response.dart'; +import 'package:receipe_app/enums/snackbar_type.dart'; import 'package:receipe_app/exceptions/receipe_exceptions.dart'; +import 'package:receipe_app/generated/l10n.dart'; import 'package:receipe_app/services/authentication_service.dart'; import 'package:receipe_app/ui/views/login/login_view.form.dart'; import 'package:stacked/stacked.dart'; @@ -13,14 +15,28 @@ class LoginViewModel extends FormViewModel { final _navigationService = locator(); final _authenticationService = locator(); final _dialogService = locator(); + final _snackbarService = locator(); final _logger = getLogger('LoginViewModel'); + bool hidePassword = true; + String? loginEmailValidatorValue; + String? loginPasswordValidatorValue; + void toggleVisibility() { hidePassword = !hidePassword; rebuildUi(); } + void showLoginSnackBar(String? value) { + _snackbarService.showCustomSnackBar( + message: value!, + variant: SnackbarType.custom, + duration: const Duration(seconds: 1), + ); + _snackbarService.closeSnackbar(); + } + Future login() async { setBusy(true); try { @@ -33,7 +49,7 @@ class LoginViewModel extends FormViewModel { ); if (response == null) { _dialogService.showDialog( - description: "Unknown error", + description: S.current.unknown_error, ); return; } @@ -48,7 +64,7 @@ class LoginViewModel extends FormViewModel { } catch (e, s) { _logger.e('An error occurred while login in', e, s); _dialogService.showDialog( - description: "Unknown error", + description: S.current.unknown_error, ); } finally { setBusy(false); diff --git a/lib/ui/views/signup/signup_view.dart b/lib/ui/views/signup/signup_view.dart index ef55d4e..1a79cd1 100644 --- a/lib/ui/views/signup/signup_view.dart +++ b/lib/ui/views/signup/signup_view.dart @@ -38,9 +38,10 @@ class SignupView extends StackedView with $SignupView { isBusy: viewModel.isBusy, content: SingleChildScrollView( padding: EdgeInsets.only( - left: sidePadding, - right: sidePadding, - bottom: sidePadding + 20.h), + left: sidePadding, + right: sidePadding, + bottom: sidePadding + 20.h, + ), child: Form( key: _signupKey, child: Column( @@ -66,7 +67,7 @@ class SignupView extends StackedView with $SignupView { Align( alignment: Alignment.centerLeft, child: Text( - "Kindly fill the form to create a Kally Dish account", + S.current.kindly_fill_form, style: context.typography?.titleRegular16 ?.copyWith(color: context.palette?.gray8), ), @@ -77,7 +78,13 @@ class SignupView extends StackedView with $SignupView { TextFormField( controller: firstNameController, focusNode: firstNameFocusNode, - validator: Validation.validateField, + validator: (value) { + return viewModel.firstNameValidatorValue = + Validation.validateField( + value, + errorMessage: S.current.first_name_required, + ); + }, textInputAction: TextInputAction.next, decoration: InputDecoration( labelText: S.current.first_name, @@ -90,7 +97,13 @@ class SignupView extends StackedView with $SignupView { TextFormField( controller: lastNameController, focusNode: lastNameFocusNode, - validator: Validation.validateField, + validator: (value) { + return viewModel.lastNameValidatorValue = + Validation.validateField( + value, + errorMessage: S.current.last_name_required, + ); + }, textInputAction: TextInputAction.next, decoration: InputDecoration( labelText: S.current.last_name, @@ -106,7 +119,10 @@ class SignupView extends StackedView with $SignupView { autofillHints: const [AutofillHints.email], keyboardType: TextInputType.emailAddress, textInputAction: TextInputAction.next, - validator: Validation.validateEmail, + validator: (value) { + return viewModel.signUpEmailValidatorValue = + Validation.validateEmail(value); + }, decoration: InputDecoration( labelText: S.current.email_address, hintText: S.current.enter_your_email), @@ -119,7 +135,10 @@ class SignupView extends StackedView with $SignupView { focusNode: passwordFocusNode, obscureText: viewModel.hidePassword, textInputAction: TextInputAction.next, - validator: Validation.validateField, + validator: (value) { + return viewModel.signUpPasswordValidatorValue = + Validation.validatePassword(value); + }, decoration: InputDecoration( labelText: S.current.password, hintText: S.current.enter_your_password, @@ -145,10 +164,13 @@ class SignupView extends StackedView with $SignupView { autofillHints: const [AutofillHints.telephoneNumber], keyboardType: TextInputType.phone, textInputAction: TextInputAction.done, - validator: Validation.validateField, + validator: (value) { + return viewModel.signUpPasswordValidatorValue = + Validation.validatePhoneNumber(value); + }, decoration: InputDecoration( - labelText: "Phone number", - hintText: "Enter phone number", + labelText: S.current.phone_number, + hintText: "080...", ), ), SizedBox( @@ -157,7 +179,14 @@ class SignupView extends StackedView with $SignupView { PrimaryButton( buttonText: S.current.sign_up, onTap: () { - if (_signupKey.currentState?.validate() ?? false) { + if (_signupKey.currentState?.validate() == false) { + viewModel.showSignUpSnackbar( + viewModel.firstNameValidatorValue ?? + viewModel.lastNameValidatorValue ?? + viewModel.signUpEmailValidatorValue ?? + viewModel.signUpPasswordValidatorValue, + ); + } else { viewModel.signup(); } }, diff --git a/lib/ui/views/signup/signup_viewmodel.dart b/lib/ui/views/signup/signup_viewmodel.dart index 5877392..67c8f76 100644 --- a/lib/ui/views/signup/signup_viewmodel.dart +++ b/lib/ui/views/signup/signup_viewmodel.dart @@ -2,6 +2,7 @@ import 'package:receipe_app/app/app.locator.dart'; import 'package:receipe_app/app/app.logger.dart'; import 'package:receipe_app/data_model/register_model.dart'; import 'package:receipe_app/data_model/user.dart'; +import 'package:receipe_app/enums/snackbar_type.dart'; import 'package:receipe_app/exceptions/receipe_exceptions.dart'; import 'package:receipe_app/services/authentication_service.dart'; import 'package:receipe_app/ui/views/signup/signup_view.form.dart'; @@ -12,9 +13,16 @@ class SignupViewModel extends FormViewModel { final _navigationService = locator(); final _authenticationService = locator(); final _dialogService = locator(); + final _snackbarService = locator(); + final _logger = getLogger('SignupViewModel'); bool hidePassword = true; + String? firstNameValidatorValue; + String? lastNameValidatorValue; + String? signUpEmailValidatorValue; + String? signUpPasswordValidatorValue; + void togglePassword() { hidePassword = !hidePassword; rebuildUi(); @@ -24,6 +32,15 @@ class SignupViewModel extends FormViewModel { _navigationService.back(); } + void showSignUpSnackbar(String? value) { + _snackbarService.showCustomSnackBar( + message: value!, + variant: SnackbarType.custom, + duration: const Duration(seconds: 1), + ); + _snackbarService.closeSnackbar(); + } + Future signup() async { setBusy(true); try { diff --git a/lib/ui/widgets/common/app_drawer/app_drawer.dart b/lib/ui/widgets/common/app_drawer/app_drawer.dart index d8b3c20..b577086 100644 --- a/lib/ui/widgets/common/app_drawer/app_drawer.dart +++ b/lib/ui/widgets/common/app_drawer/app_drawer.dart @@ -1,6 +1,8 @@ import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_svg/flutter_svg.dart'; +import 'package:receipe_app/app/app.logger.dart'; +import 'package:receipe_app/enums/languages.dart'; import 'package:receipe_app/generated/l10n.dart'; import 'package:receipe_app/ui/common/app_images.dart'; import 'package:receipe_app/ui/extension/build_context_extension.dart'; @@ -10,7 +12,7 @@ import 'dart:io'; import 'package:flutter/cupertino.dart'; class AppDrawer extends StackedView { - const AppDrawer({super.key}); + AppDrawer({super.key}); @override AppDrawerModel viewModelBuilder( @@ -18,6 +20,7 @@ class AppDrawer extends StackedView { ) => AppDrawerModel(); + final _logger = getLogger('AppDrawer'); @override Widget builder( BuildContext context, @@ -99,6 +102,36 @@ class AppDrawer extends StackedView { ), SizedBox(height: 10.h), Divider(thickness: 15.w, color: context.palette?.gray1), + ListTile( + leading: Icon(Icons.translate), + title: DropdownButton( + padding: EdgeInsets.all(20), + isExpanded: true, + borderRadius: BorderRadius.all(Radius.circular(10)), + value: viewModel.selectedLanguage, + items: Languages.values + .map( + (language) => DropdownMenuItem( + value: language, + child: Text(language.name.toUpperCase()), + ), + ) + .toList(), + onChanged: (value) { + if (value == null) return; + _logger.i(value); + + final subtag = value.name.substring(0, 2); + S.load( + Locale.fromSubtags( + languageCode: subtag, + ), + ); //Load the current locale using the subtag + viewModel.toggleLanguage(value); + }, + ), + ), + Divider(thickness: 15.w, color: context.palette?.gray1), Spacer(), Divider( thickness: 10.w, diff --git a/lib/ui/widgets/common/app_drawer/app_drawer_model.dart b/lib/ui/widgets/common/app_drawer/app_drawer_model.dart index 4e4f933..0001e21 100644 --- a/lib/ui/widgets/common/app_drawer/app_drawer_model.dart +++ b/lib/ui/widgets/common/app_drawer/app_drawer_model.dart @@ -1,21 +1,33 @@ import 'package:receipe_app/app/app.router.dart'; import 'package:receipe_app/data_model/user.dart'; +import 'package:receipe_app/enums/languages.dart'; +import 'package:receipe_app/services/localization_service.dart'; import 'package:receipe_app/services/secure_storage_service.dart'; import 'package:receipe_app/services/user_service.dart'; import 'package:stacked/stacked.dart'; import 'package:receipe_app/app/app.locator.dart'; import 'package:receipe_app/app/app.logger.dart'; - import 'package:stacked_services/stacked_services.dart'; class AppDrawerModel extends ReactiveViewModel { final _navigationService = locator(); final _userService = locator(); final _secureStorageService = locator(); + final _localizationService = locator(); + + final _logger = getLogger('App_Drawer ViewModel'); User? get user => _userService.user; - final _logger = getLogger('App_Drawer'); + Languages get selectedLanguage => _localizationService.selectedLocale; + + //toggle and refresh Language dropdown + void toggleLanguage(Languages value) { + _logger.i(value); + + _localizationService.assignLocale(value); + rebuildUi(); + } void navigateToHome() { _logger.i("go back"); diff --git a/pubspec.lock b/pubspec.lock index 0992e05..e986efb 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -173,10 +173,10 @@ packages: dependency: transitive description: name: collection - sha256: f092b211a4319e98e5ff58223576de6c2803db36221657b46c82574721240687 + sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a url: "https://pub.dev" source: hosted - version: "1.17.2" + version: "1.18.0" convert: dependency: transitive description: @@ -513,10 +513,10 @@ packages: dependency: transitive description: name: meta - sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3" + sha256: a6e590c838b18133bb482a2745ad77c5bb7715fb0451209e1a7567d416678b8e url: "https://pub.dev" source: hosted - version: "1.9.1" + version: "1.10.0" mime: dependency: transitive description: @@ -830,10 +830,10 @@ packages: dependency: transitive description: name: stack_trace - sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5 + sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" url: "https://pub.dev" source: hosted - version: "1.11.0" + version: "1.11.1" stacked: dependency: "direct main" description: @@ -870,10 +870,10 @@ packages: dependency: transitive description: name: stream_channel - sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8" + sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 url: "https://pub.dev" source: hosted - version: "2.1.1" + version: "2.1.2" stream_transform: dependency: transitive description: @@ -910,10 +910,10 @@ packages: dependency: transitive description: name: test_api - sha256: "75760ffd7786fffdfb9597c35c5b27eaeec82be8edfb6d71d32651128ed7aab8" + sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b" url: "https://pub.dev" source: hosted - version: "0.6.0" + version: "0.6.1" timing: dependency: transitive description: @@ -990,10 +990,10 @@ packages: dependency: transitive description: name: web - sha256: dc8ccd225a2005c1be616fe02951e2e342092edf968cf0844220383757ef8f10 + sha256: afe077240a270dcfd2aafe77602b4113645af95d0ad31128cc02bce5ac5d5152 url: "https://pub.dev" source: hosted - version: "0.1.4-beta" + version: "0.3.0" web_socket_channel: dependency: transitive description: @@ -1035,5 +1035,5 @@ packages: source: hosted version: "3.1.2" sdks: - dart: ">=3.1.0 <4.0.0" + dart: ">=3.2.0-194.0.dev <4.0.0" flutter: ">=3.13.0" diff --git a/test/helpers/test_helpers.dart b/test/helpers/test_helpers.dart index 6e60932..af387d3 100644 --- a/test/helpers/test_helpers.dart +++ b/test/helpers/test_helpers.dart @@ -10,6 +10,7 @@ import 'package:receipe_app/services/authentication_service.dart'; import 'package:receipe_app/services/dish_service.dart'; import 'package:receipe_app/services/database_service.dart'; import 'package:receipe_app/services/user_service.dart'; +import 'package:receipe_app/services/localization_service.dart'; // @stacked-import import 'test_helpers.mocks.dart'; @@ -25,6 +26,8 @@ import 'test_helpers.mocks.dart'; MockSpec(onMissingStub: OnMissingStub.returnDefault), MockSpec(onMissingStub: OnMissingStub.returnDefault), MockSpec(onMissingStub: OnMissingStub.returnDefault), + MockSpec(onMissingStub: OnMissingStub.returnDefault), + // @stacked-mock-spec ]) void registerServices() { @@ -38,6 +41,7 @@ void registerServices() { getAndRegisterDishService(); getAndRegisterDatabaseService(); getAndRegisterUserService(); + getAndRegisterLocalizationService(); // @stacked-mock-register } @@ -142,6 +146,15 @@ MockUserService getAndRegisterUserService() { locator.registerSingleton(service); return service; } + +MockLocalizationService getAndRegisterLocalizationService() { + _removeRegistrationIfExists(); + final service = MockLocalizationService(); + locator.registerSingleton(service); + return service; +} + +// // @stacked-mock-create void _removeRegistrationIfExists() { diff --git a/test/helpers/test_helpers.mocks.dart b/test/helpers/test_helpers.mocks.dart index 72a8236..d4eb2ce 100644 --- a/test/helpers/test_helpers.mocks.dart +++ b/test/helpers/test_helpers.mocks.dart @@ -3,10 +3,10 @@ // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes -import 'dart:async' as _i6; -import 'dart:ui' as _i7; +import 'dart:async' as _i7; +import 'dart:ui' as _i4; -import 'package:flutter/material.dart' as _i5; +import 'package:flutter/material.dart' as _i6; import 'package:mockito/mockito.dart' as _i1; import 'package:receipe_app/data_model/create_dish_info.dart' as _i18; import 'package:receipe_app/data_model/event.dart' as _i9; @@ -15,15 +15,17 @@ import 'package:receipe_app/data_model/login_response.dart' as _i13; import 'package:receipe_app/data_model/recipes_response.dart' as _i2; import 'package:receipe_app/data_model/register_model.dart' as _i16; import 'package:receipe_app/data_model/user.dart' as _i15; +import 'package:receipe_app/enums/languages.dart' as _i22; import 'package:receipe_app/services/authentication_service.dart' as _i12; import 'package:receipe_app/services/database_service.dart' as _i19; import 'package:receipe_app/services/dio_service.dart' as _i11; import 'package:receipe_app/services/dish_service.dart' as _i17; import 'package:receipe_app/services/event_service.dart' as _i8; +import 'package:receipe_app/services/localization_service.dart' as _i21; import 'package:receipe_app/services/secure_storage_service.dart' as _i10; import 'package:receipe_app/services/user_service.dart' as _i20; import 'package:sqflite/sqflite.dart' as _i3; -import 'package:stacked_services/stacked_services.dart' as _i4; +import 'package:stacked_services/stacked_services.dart' as _i5; // ignore_for_file: type=lint // ignore_for_file: avoid_redundant_argument_values @@ -57,10 +59,20 @@ class _FakeDatabase_1 extends _i1.SmartFake implements _i3.Database { ); } +class _FakeLocale_2 extends _i1.SmartFake implements _i4.Locale { + _FakeLocale_2( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + /// A class which mocks [NavigationService]. /// /// See the documentation for Mockito's code generation for more information. -class MockNavigationService extends _i1.Mock implements _i4.NavigationService { +class MockNavigationService extends _i1.Mock implements _i5.NavigationService { @override String get previousRoute => (super.noSuchMethod( Invocation.getter(#previousRoute), @@ -74,14 +86,14 @@ class MockNavigationService extends _i1.Mock implements _i4.NavigationService { returnValueForMissingStub: '', ) as String); @override - _i5.GlobalKey<_i5.NavigatorState>? nestedNavigationKey(int? index) => + _i6.GlobalKey<_i6.NavigatorState>? nestedNavigationKey(int? index) => (super.noSuchMethod( Invocation.method( #nestedNavigationKey, [index], ), returnValueForMissingStub: null, - ) as _i5.GlobalKey<_i5.NavigatorState>?); + ) as _i6.GlobalKey<_i6.NavigatorState>?); @override void config({ bool? enableLog, @@ -89,7 +101,7 @@ class MockNavigationService extends _i1.Mock implements _i4.NavigationService { bool? defaultOpaqueRoute, Duration? defaultDurationTransition, bool? defaultGlobalState, - _i4.Transition? defaultTransitionStyle, + _i5.Transition? defaultTransitionStyle, String? defaultTransition, }) => super.noSuchMethod( @@ -109,18 +121,18 @@ class MockNavigationService extends _i1.Mock implements _i4.NavigationService { returnValueForMissingStub: null, ); @override - _i6.Future? navigateWithTransition( - _i5.Widget? page, { + _i7.Future? navigateWithTransition( + _i6.Widget? page, { bool? opaque, String? transition = r'', Duration? duration, bool? popGesture, int? id, - _i5.Curve? curve, + _i6.Curve? curve, bool? fullscreenDialog = false, bool? preventDuplicates = true, - _i4.Transition? transitionClass, - _i4.Transition? transitionStyle, + _i5.Transition? transitionClass, + _i5.Transition? transitionStyle, String? routeName, }) => (super.noSuchMethod( @@ -142,20 +154,20 @@ class MockNavigationService extends _i1.Mock implements _i4.NavigationService { }, ), returnValueForMissingStub: null, - ) as _i6.Future?); + ) as _i7.Future?); @override - _i6.Future? replaceWithTransition( - _i5.Widget? page, { + _i7.Future? replaceWithTransition( + _i6.Widget? page, { bool? opaque, String? transition = r'', Duration? duration, bool? popGesture, int? id, - _i5.Curve? curve, + _i6.Curve? curve, bool? fullscreenDialog = false, bool? preventDuplicates = true, - _i4.Transition? transitionClass, - _i4.Transition? transitionStyle, + _i5.Transition? transitionClass, + _i5.Transition? transitionStyle, String? routeName, }) => (super.noSuchMethod( @@ -177,7 +189,7 @@ class MockNavigationService extends _i1.Mock implements _i4.NavigationService { }, ), returnValueForMissingStub: null, - ) as _i6.Future?); + ) as _i7.Future?); @override bool back({ dynamic result, @@ -197,7 +209,7 @@ class MockNavigationService extends _i1.Mock implements _i4.NavigationService { ) as bool); @override void popUntil( - _i5.RoutePredicate? predicate, { + _i6.RoutePredicate? predicate, { int? id, }) => super.noSuchMethod( @@ -217,13 +229,13 @@ class MockNavigationService extends _i1.Mock implements _i4.NavigationService { returnValueForMissingStub: null, ); @override - _i6.Future? navigateTo( + _i7.Future? navigateTo( String? routeName, { dynamic arguments, int? id, bool? preventDuplicates = true, Map? parameters, - _i5.RouteTransitionsBuilder? transition, + _i6.RouteTransitionsBuilder? transition, }) => (super.noSuchMethod( Invocation.method( @@ -238,20 +250,20 @@ class MockNavigationService extends _i1.Mock implements _i4.NavigationService { }, ), returnValueForMissingStub: null, - ) as _i6.Future?); + ) as _i7.Future?); @override - _i6.Future? navigateToView( - _i5.Widget? view, { + _i7.Future? navigateToView( + _i6.Widget? view, { dynamic arguments, int? id, bool? opaque, - _i5.Curve? curve, + _i6.Curve? curve, Duration? duration, bool? fullscreenDialog = false, bool? popGesture, bool? preventDuplicates = true, - _i4.Transition? transition, - _i4.Transition? transitionStyle, + _i5.Transition? transition, + _i5.Transition? transitionStyle, }) => (super.noSuchMethod( Invocation.method( @@ -271,15 +283,15 @@ class MockNavigationService extends _i1.Mock implements _i4.NavigationService { }, ), returnValueForMissingStub: null, - ) as _i6.Future?); + ) as _i7.Future?); @override - _i6.Future? replaceWith( + _i7.Future? replaceWith( String? routeName, { dynamic arguments, int? id, bool? preventDuplicates = true, Map? parameters, - _i5.RouteTransitionsBuilder? transition, + _i6.RouteTransitionsBuilder? transition, }) => (super.noSuchMethod( Invocation.method( @@ -294,9 +306,9 @@ class MockNavigationService extends _i1.Mock implements _i4.NavigationService { }, ), returnValueForMissingStub: null, - ) as _i6.Future?); + ) as _i7.Future?); @override - _i6.Future? clearStackAndShow( + _i7.Future? clearStackAndShow( String? routeName, { dynamic arguments, int? id, @@ -313,10 +325,10 @@ class MockNavigationService extends _i1.Mock implements _i4.NavigationService { }, ), returnValueForMissingStub: null, - ) as _i6.Future?); + ) as _i7.Future?); @override - _i6.Future? clearStackAndShowView( - _i5.Widget? view, { + _i7.Future? clearStackAndShowView( + _i6.Widget? view, { dynamic arguments, int? id, }) => @@ -330,9 +342,9 @@ class MockNavigationService extends _i1.Mock implements _i4.NavigationService { }, ), returnValueForMissingStub: null, - ) as _i6.Future?); + ) as _i7.Future?); @override - _i6.Future? clearTillFirstAndShow( + _i7.Future? clearTillFirstAndShow( String? routeName, { dynamic arguments, int? id, @@ -351,10 +363,10 @@ class MockNavigationService extends _i1.Mock implements _i4.NavigationService { }, ), returnValueForMissingStub: null, - ) as _i6.Future?); + ) as _i7.Future?); @override - _i6.Future? clearTillFirstAndShowView( - _i5.Widget? view, { + _i7.Future? clearTillFirstAndShowView( + _i6.Widget? view, { dynamic arguments, int? id, }) => @@ -368,11 +380,11 @@ class MockNavigationService extends _i1.Mock implements _i4.NavigationService { }, ), returnValueForMissingStub: null, - ) as _i6.Future?); + ) as _i7.Future?); @override - _i6.Future? pushNamedAndRemoveUntil( + _i7.Future? pushNamedAndRemoveUntil( String? routeName, { - _i5.RoutePredicate? predicate, + _i6.RoutePredicate? predicate, dynamic arguments, int? id, }) => @@ -387,16 +399,16 @@ class MockNavigationService extends _i1.Mock implements _i4.NavigationService { }, ), returnValueForMissingStub: null, - ) as _i6.Future?); + ) as _i7.Future?); } /// A class which mocks [BottomSheetService]. /// /// See the documentation for Mockito's code generation for more information. class MockBottomSheetService extends _i1.Mock - implements _i4.BottomSheetService { + implements _i5.BottomSheetService { @override - void setCustomSheetBuilders(Map? builders) => + void setCustomSheetBuilders(Map? builders) => super.noSuchMethod( Invocation.method( #setCustomSheetBuilders, @@ -405,7 +417,7 @@ class MockBottomSheetService extends _i1.Mock returnValueForMissingStub: null, ); @override - _i6.Future<_i4.SheetResponse?> showBottomSheet({ + _i7.Future<_i5.SheetResponse?> showBottomSheet({ required String? title, String? description, String? confirmButtonTitle = r'Ok', @@ -436,12 +448,12 @@ class MockBottomSheetService extends _i1.Mock #useRootNavigator: useRootNavigator, }, ), - returnValue: _i6.Future<_i4.SheetResponse?>.value(), + returnValue: _i7.Future<_i5.SheetResponse?>.value(), returnValueForMissingStub: - _i6.Future<_i4.SheetResponse?>.value(), - ) as _i6.Future<_i4.SheetResponse?>); + _i7.Future<_i5.SheetResponse?>.value(), + ) as _i7.Future<_i5.SheetResponse?>); @override - _i6.Future<_i4.SheetResponse?> showCustomSheet({ + _i7.Future<_i5.SheetResponse?> showCustomSheet({ dynamic variant, String? title, String? description, @@ -454,7 +466,7 @@ class MockBottomSheetService extends _i1.Mock bool? showIconInAdditionalButton = false, String? additionalButtonTitle, bool? takesInput = false, - _i7.Color? barrierColor = const _i7.Color(2315255808), + _i4.Color? barrierColor = const _i4.Color(2315255808), bool? barrierDismissible = true, bool? isScrollControlled = false, String? barrierLabel = r'', @@ -496,11 +508,11 @@ class MockBottomSheetService extends _i1.Mock #useRootNavigator: useRootNavigator, }, ), - returnValue: _i6.Future<_i4.SheetResponse?>.value(), - returnValueForMissingStub: _i6.Future<_i4.SheetResponse?>.value(), - ) as _i6.Future<_i4.SheetResponse?>); + returnValue: _i7.Future<_i5.SheetResponse?>.value(), + returnValueForMissingStub: _i7.Future<_i5.SheetResponse?>.value(), + ) as _i7.Future<_i5.SheetResponse?>); @override - void completeSheet(_i4.SheetResponse? response) => + void completeSheet(_i5.SheetResponse? response) => super.noSuchMethod( Invocation.method( #completeSheet, @@ -513,10 +525,10 @@ class MockBottomSheetService extends _i1.Mock /// A class which mocks [DialogService]. /// /// See the documentation for Mockito's code generation for more information. -class MockDialogService extends _i1.Mock implements _i4.DialogService { +class MockDialogService extends _i1.Mock implements _i5.DialogService { @override void registerCustomDialogBuilders( - Map? builders) => + Map? builders) => super.noSuchMethod( Invocation.method( #registerCustomDialogBuilders, @@ -527,10 +539,10 @@ class MockDialogService extends _i1.Mock implements _i4.DialogService { @override void registerCustomDialogBuilder({ required dynamic variant, - required _i5.Widget Function( - _i5.BuildContext, - _i4.DialogRequest, - dynamic Function(_i4.DialogResponse), + required _i6.Widget Function( + _i6.BuildContext, + _i5.DialogRequest, + dynamic Function(_i5.DialogResponse), )? builder, }) => super.noSuchMethod( @@ -545,15 +557,15 @@ class MockDialogService extends _i1.Mock implements _i4.DialogService { returnValueForMissingStub: null, ); @override - _i6.Future<_i4.DialogResponse?> showDialog({ + _i7.Future<_i5.DialogResponse?> showDialog({ String? title, String? description, String? cancelTitle, - _i7.Color? cancelTitleColor, + _i4.Color? cancelTitleColor, String? buttonTitle = r'Ok', - _i7.Color? buttonTitleColor, + _i4.Color? buttonTitleColor, bool? barrierDismissible = false, - _i4.DialogPlatform? dialogPlatform, + _i5.DialogPlatform? dialogPlatform, }) => (super.noSuchMethod( Invocation.method( @@ -570,12 +582,12 @@ class MockDialogService extends _i1.Mock implements _i4.DialogService { #dialogPlatform: dialogPlatform, }, ), - returnValue: _i6.Future<_i4.DialogResponse?>.value(), + returnValue: _i7.Future<_i5.DialogResponse?>.value(), returnValueForMissingStub: - _i6.Future<_i4.DialogResponse?>.value(), - ) as _i6.Future<_i4.DialogResponse?>); + _i7.Future<_i5.DialogResponse?>.value(), + ) as _i7.Future<_i5.DialogResponse?>); @override - _i6.Future<_i4.DialogResponse?> showCustomDialog({ + _i7.Future<_i5.DialogResponse?> showCustomDialog({ dynamic variant, String? title, String? description, @@ -588,7 +600,7 @@ class MockDialogService extends _i1.Mock implements _i4.DialogService { bool? showIconInAdditionalButton = false, String? additionalButtonTitle, bool? takesInput = false, - _i7.Color? barrierColor = const _i7.Color(2315255808), + _i4.Color? barrierColor = const _i4.Color(2315255808), bool? barrierDismissible = false, String? barrierLabel = r'', bool? useSafeArea = true, @@ -620,19 +632,19 @@ class MockDialogService extends _i1.Mock implements _i4.DialogService { #data: data, }, ), - returnValue: _i6.Future<_i4.DialogResponse?>.value(), - returnValueForMissingStub: _i6.Future<_i4.DialogResponse?>.value(), - ) as _i6.Future<_i4.DialogResponse?>); + returnValue: _i7.Future<_i5.DialogResponse?>.value(), + returnValueForMissingStub: _i7.Future<_i5.DialogResponse?>.value(), + ) as _i7.Future<_i5.DialogResponse?>); @override - _i6.Future<_i4.DialogResponse?> showConfirmationDialog({ + _i7.Future<_i5.DialogResponse?> showConfirmationDialog({ String? title, String? description, String? cancelTitle = r'Cancel', - _i7.Color? cancelTitleColor, + _i4.Color? cancelTitleColor, String? confirmationTitle = r'Ok', - _i7.Color? confirmationTitleColor, + _i4.Color? confirmationTitleColor, bool? barrierDismissible = false, - _i4.DialogPlatform? dialogPlatform, + _i5.DialogPlatform? dialogPlatform, }) => (super.noSuchMethod( Invocation.method( @@ -649,12 +661,12 @@ class MockDialogService extends _i1.Mock implements _i4.DialogService { #dialogPlatform: dialogPlatform, }, ), - returnValue: _i6.Future<_i4.DialogResponse?>.value(), + returnValue: _i7.Future<_i5.DialogResponse?>.value(), returnValueForMissingStub: - _i6.Future<_i4.DialogResponse?>.value(), - ) as _i6.Future<_i4.DialogResponse?>); + _i7.Future<_i5.DialogResponse?>.value(), + ) as _i7.Future<_i5.DialogResponse?>); @override - void completeDialog(_i4.DialogResponse? response) => + void completeDialog(_i5.DialogResponse? response) => super.noSuchMethod( Invocation.method( #completeDialog, @@ -723,61 +735,61 @@ class MockEventService extends _i1.Mock implements _i8.EventService { class MockSecureStorageService extends _i1.Mock implements _i10.SecureStorageService { @override - _i6.Future deleteAccessToken() => (super.noSuchMethod( + _i7.Future deleteAccessToken() => (super.noSuchMethod( Invocation.method( #deleteAccessToken, [], ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); + returnValue: _i7.Future.value(), + returnValueForMissingStub: _i7.Future.value(), + ) as _i7.Future); @override - _i6.Future deleteRefreshToken() => (super.noSuchMethod( + _i7.Future deleteRefreshToken() => (super.noSuchMethod( Invocation.method( #deleteRefreshToken, [], ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); + returnValue: _i7.Future.value(), + returnValueForMissingStub: _i7.Future.value(), + ) as _i7.Future); @override - _i6.Future readAccessToken() => (super.noSuchMethod( + _i7.Future readAccessToken() => (super.noSuchMethod( Invocation.method( #readAccessToken, [], ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); + returnValue: _i7.Future.value(), + returnValueForMissingStub: _i7.Future.value(), + ) as _i7.Future); @override - _i6.Future readRefreshToken() => (super.noSuchMethod( + _i7.Future readRefreshToken() => (super.noSuchMethod( Invocation.method( #readRefreshToken, [], ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); + returnValue: _i7.Future.value(), + returnValueForMissingStub: _i7.Future.value(), + ) as _i7.Future); @override - _i6.Future writeAccessToken({String? token}) => (super.noSuchMethod( + _i7.Future writeAccessToken({String? token}) => (super.noSuchMethod( Invocation.method( #writeAccessToken, [], {#token: token}, ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); + returnValue: _i7.Future.value(), + returnValueForMissingStub: _i7.Future.value(), + ) as _i7.Future); @override - _i6.Future writeRefreshToken({String? token}) => (super.noSuchMethod( + _i7.Future writeRefreshToken({String? token}) => (super.noSuchMethod( Invocation.method( #writeRefreshToken, [], {#token: token}, ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); + returnValue: _i7.Future.value(), + returnValueForMissingStub: _i7.Future.value(), + ) as _i7.Future); } /// A class which mocks [DioService]. @@ -785,7 +797,7 @@ class MockSecureStorageService extends _i1.Mock /// See the documentation for Mockito's code generation for more information. class MockDioService extends _i1.Mock implements _i11.DioService { @override - _i6.Future post({ + _i7.Future post({ required String? path, Map? data, Map? queryParameters, @@ -800,11 +812,11 @@ class MockDioService extends _i1.Mock implements _i11.DioService { #queryParameters: queryParameters, }, ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); + returnValue: _i7.Future.value(), + returnValueForMissingStub: _i7.Future.value(), + ) as _i7.Future); @override - _i6.Future get({ + _i7.Future get({ required String? path, Map? queryParameters, }) => @@ -817,11 +829,11 @@ class MockDioService extends _i1.Mock implements _i11.DioService { #queryParameters: queryParameters, }, ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); + returnValue: _i7.Future.value(), + returnValueForMissingStub: _i7.Future.value(), + ) as _i7.Future); @override - _i6.Future put({ + _i7.Future put({ required String? path, Map? data, Map? queryParameters, @@ -836,11 +848,11 @@ class MockDioService extends _i1.Mock implements _i11.DioService { #queryParameters: queryParameters, }, ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); + returnValue: _i7.Future.value(), + returnValueForMissingStub: _i7.Future.value(), + ) as _i7.Future); @override - _i6.Future patch({ + _i7.Future patch({ required String? path, Map? data, Map? queryParameters, @@ -855,11 +867,11 @@ class MockDioService extends _i1.Mock implements _i11.DioService { #queryParameters: queryParameters, }, ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); + returnValue: _i7.Future.value(), + returnValueForMissingStub: _i7.Future.value(), + ) as _i7.Future); @override - _i6.Future delete({ + _i7.Future delete({ required String? path, Map? data, Map? queryParameters, @@ -874,9 +886,9 @@ class MockDioService extends _i1.Mock implements _i11.DioService { #queryParameters: queryParameters, }, ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); + returnValue: _i7.Future.value(), + returnValueForMissingStub: _i7.Future.value(), + ) as _i7.Future); } /// A class which mocks [AuthenticationService]. @@ -885,26 +897,26 @@ class MockDioService extends _i1.Mock implements _i11.DioService { class MockAuthenticationService extends _i1.Mock implements _i12.AuthenticationService { @override - _i6.Future<_i13.LoginResponse?> login({_i14.LoginModel? loginModel}) => + _i7.Future<_i13.LoginResponse?> login({_i14.LoginModel? loginModel}) => (super.noSuchMethod( Invocation.method( #login, [], {#loginModel: loginModel}, ), - returnValue: _i6.Future<_i13.LoginResponse?>.value(), - returnValueForMissingStub: _i6.Future<_i13.LoginResponse?>.value(), - ) as _i6.Future<_i13.LoginResponse?>); + returnValue: _i7.Future<_i13.LoginResponse?>.value(), + returnValueForMissingStub: _i7.Future<_i13.LoginResponse?>.value(), + ) as _i7.Future<_i13.LoginResponse?>); @override - _i6.Future<_i15.User?> register(_i16.RegisterModel? registerModel) => + _i7.Future<_i15.User?> register(_i16.RegisterModel? registerModel) => (super.noSuchMethod( Invocation.method( #register, [registerModel], ), - returnValue: _i6.Future<_i15.User?>.value(), - returnValueForMissingStub: _i6.Future<_i15.User?>.value(), - ) as _i6.Future<_i15.User?>); + returnValue: _i7.Future<_i15.User?>.value(), + returnValueForMissingStub: _i7.Future<_i15.User?>.value(), + ) as _i7.Future<_i15.User?>); } /// A class which mocks [DishService]. @@ -912,22 +924,22 @@ class MockAuthenticationService extends _i1.Mock /// See the documentation for Mockito's code generation for more information. class MockDishService extends _i1.Mock implements _i17.DishService { @override - _i6.Future createDish(_i18.CreateDishInfo? info) => + _i7.Future createDish(_i18.CreateDishInfo? info) => (super.noSuchMethod( Invocation.method( #createDish, [info], ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); + returnValue: _i7.Future.value(), + returnValueForMissingStub: _i7.Future.value(), + ) as _i7.Future); @override - _i6.Future<_i2.RecipesResponseModel> getAllDishes() => (super.noSuchMethod( + _i7.Future<_i2.RecipesResponseModel> getAllDishes() => (super.noSuchMethod( Invocation.method( #getAllDishes, [], ), - returnValue: _i6.Future<_i2.RecipesResponseModel>.value( + returnValue: _i7.Future<_i2.RecipesResponseModel>.value( _FakeRecipesResponseModel_0( this, Invocation.method( @@ -935,7 +947,7 @@ class MockDishService extends _i1.Mock implements _i17.DishService { [], ), )), - returnValueForMissingStub: _i6.Future<_i2.RecipesResponseModel>.value( + returnValueForMissingStub: _i7.Future<_i2.RecipesResponseModel>.value( _FakeRecipesResponseModel_0( this, Invocation.method( @@ -943,7 +955,30 @@ class MockDishService extends _i1.Mock implements _i17.DishService { [], ), )), - ) as _i6.Future<_i2.RecipesResponseModel>); + ) as _i7.Future<_i2.RecipesResponseModel>); + @override + _i7.Future<_i2.RecipesResponseModel> getUserDishes() => (super.noSuchMethod( + Invocation.method( + #getUserDishes, + [], + ), + returnValue: _i7.Future<_i2.RecipesResponseModel>.value( + _FakeRecipesResponseModel_0( + this, + Invocation.method( + #getUserDishes, + [], + ), + )), + returnValueForMissingStub: _i7.Future<_i2.RecipesResponseModel>.value( + _FakeRecipesResponseModel_0( + this, + Invocation.method( + #getUserDishes, + [], + ), + )), + ) as _i7.Future<_i2.RecipesResponseModel>); } /// A class which mocks [DatabaseService]. @@ -971,41 +1006,41 @@ class MockDatabaseService extends _i1.Mock implements _i19.DatabaseService { returnValueForMissingStub: null, ); @override - _i6.Future init() => (super.noSuchMethod( + _i7.Future init() => (super.noSuchMethod( Invocation.method( #init, [], ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); + returnValue: _i7.Future.value(), + returnValueForMissingStub: _i7.Future.value(), + ) as _i7.Future); @override - _i6.Future clearUserData() => (super.noSuchMethod( + _i7.Future clearUserData() => (super.noSuchMethod( Invocation.method( #clearUserData, [], ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); + returnValue: _i7.Future.value(), + returnValueForMissingStub: _i7.Future.value(), + ) as _i7.Future); @override - _i6.Future mergeUser(_i15.User? user) => (super.noSuchMethod( + _i7.Future mergeUser(_i15.User? user) => (super.noSuchMethod( Invocation.method( #mergeUser, [user], ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); + returnValue: _i7.Future.value(), + returnValueForMissingStub: _i7.Future.value(), + ) as _i7.Future); @override - _i6.Future<_i15.User?> authenticatedUser() => (super.noSuchMethod( + _i7.Future<_i15.User?> authenticatedUser() => (super.noSuchMethod( Invocation.method( #authenticatedUser, [], ), - returnValue: _i6.Future<_i15.User?>.value(), - returnValueForMissingStub: _i6.Future<_i15.User?>.value(), - ) as _i6.Future<_i15.User?>); + returnValue: _i7.Future<_i15.User?>.value(), + returnValueForMissingStub: _i7.Future<_i15.User?>.value(), + ) as _i7.Future<_i15.User?>); } /// A class which mocks [UserService]. @@ -1019,23 +1054,23 @@ class MockUserService extends _i1.Mock implements _i20.UserService { returnValueForMissingStub: 0, ) as int); @override - _i6.Future delete() => (super.noSuchMethod( + _i7.Future delete() => (super.noSuchMethod( Invocation.method( #delete, [], ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); + returnValue: _i7.Future.value(), + returnValueForMissingStub: _i7.Future.value(), + ) as _i7.Future); @override - _i6.Future saveUser(_i15.User? user) => (super.noSuchMethod( + _i7.Future saveUser(_i15.User? user) => (super.noSuchMethod( Invocation.method( #saveUser, [user], ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); + returnValue: _i7.Future.value(), + returnValueForMissingStub: _i7.Future.value(), + ) as _i7.Future); @override void listenToReactiveValues(List? reactiveValues) => super.noSuchMethod( @@ -1070,3 +1105,36 @@ class MockUserService extends _i1.Mock implements _i20.UserService { returnValueForMissingStub: null, ); } + +/// A class which mocks [LocalizationService]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockLocalizationService extends _i1.Mock + implements _i21.LocalizationService { + @override + _i4.Locale get currentLocale => (super.noSuchMethod( + Invocation.getter(#currentLocale), + returnValue: _FakeLocale_2( + this, + Invocation.getter(#currentLocale), + ), + returnValueForMissingStub: _FakeLocale_2( + this, + Invocation.getter(#currentLocale), + ), + ) as _i4.Locale); + @override + _i22.Languages get selectedLocale => (super.noSuchMethod( + Invocation.getter(#selectedLocale), + returnValue: _i22.Languages.english, + returnValueForMissingStub: _i22.Languages.english, + ) as _i22.Languages); + @override + void assignLocale(_i22.Languages? value) => super.noSuchMethod( + Invocation.method( + #assignLocale, + [value], + ), + returnValueForMissingStub: null, + ); +} diff --git a/test/services/localization_service_test.dart b/test/services/localization_service_test.dart new file mode 100644 index 0000000..9326aed --- /dev/null +++ b/test/services/localization_service_test.dart @@ -0,0 +1,11 @@ +import 'package:flutter_test/flutter_test.dart'; +import 'package:receipe_app/app/app.locator.dart'; + +import '../helpers/test_helpers.dart'; + +void main() { + group('LocalizationServiceTest -', () { + setUp(() => registerServices()); + tearDown(() => locator.reset()); + }); +}