From 11c1e28aaa97a9df3307083ddda53b439d8a6595 Mon Sep 17 00:00:00 2001 From: Mark M2 Macbook Date: Thu, 30 Apr 2026 10:25:52 +0200 Subject: [PATCH] basta localizzazioni per ora Co-authored-by: Copilot --- lib/core/data/core_repository.dart | 14 +- lib/core/layout/app_shell.dart | 17 +- lib/core/routes/app_router.dart | 17 +- lib/core/utils/app_message.dart | 20 + lib/core/widgets/image_viewer_widget.dart | 5 +- lib/core/widgets/pdf_viewer_widget.dart | 5 +- lib/core/widgets/qr_upload_dialog.dart | 3 +- lib/core/widgets/set_password_screen.dart | 37 +- lib/features/auth/bloc/auth_cubit.dart | 10 +- lib/features/auth/bloc/auth_state.dart | 4 +- lib/features/auth/ui/auth_screen.dart | 30 +- lib/features/company/bloc/company_state.dart | 2 +- .../company/data/company_repository.dart | 2 +- .../company/ui/create_company_screen.dart | 40 +- .../customers/data/customer_repository.dart | 20 +- lib/features/home/ui/home_screen.dart | 24 +- lib/l10n/app_en.arb | 13 - lib/l10n/app_it.arb | 92 ++++- lib/l10n/app_localizations.dart | 350 ++++++++++++++++-- lib/l10n/app_localizations_en.dart | 39 -- lib/l10n/app_localizations_it.dart | 181 ++++++++- lib/main.dart | 4 +- pubspec.yaml | 4 +- 23 files changed, 720 insertions(+), 213 deletions(-) create mode 100644 lib/core/utils/app_message.dart delete mode 100644 lib/l10n/app_en.arb delete mode 100644 lib/l10n/app_localizations_en.dart diff --git a/lib/core/data/core_repository.dart b/lib/core/data/core_repository.dart index 192e412..6aeac53 100644 --- a/lib/core/data/core_repository.dart +++ b/lib/core/data/core_repository.dart @@ -24,7 +24,7 @@ class CoreRepository { return CompanyModel.fromMap(response); } catch (e) { debugPrint('Errore recupero azienda: $e'); - throw Exception('Errore recupero azienda: $e'); + throw Exception('$e'); } } @@ -38,7 +38,7 @@ class CoreRepository { if (response == null) return null; return CompanyModel.fromMap(response); } catch (e) { - debugPrint('Errore recupero azienda per ID: $e'); + debugPrint('$e'); return null; } } @@ -55,7 +55,7 @@ class CoreRepository { return (response as List).map((s) => StoreModel.fromMap(s)).toList(); } catch (e) { debugPrint('Errore recupero negozi: $e'); - throw Exception('Errore recupero negozi: $e'); + throw Exception('$e'); } } @@ -71,7 +71,7 @@ class CoreRepository { return StaffMemberModel.fromMap(response); } catch (e) { debugPrint('Errore recupero profilo staff: $e'); - throw Exception('Errore recupero profilo staff: $e'); + throw Exception('$e'); } } @@ -87,7 +87,7 @@ class CoreRepository { return CompanyModel.fromMap(response); } catch (e) { debugPrint('Creazione azienda fallita: $e'); - throw Exception('Creazione azienda fallita: $e'); + throw Exception('$e'); } } @@ -101,7 +101,7 @@ class CoreRepository { return StoreModel.fromMap(response); } catch (e) { debugPrint('Creazione negozio fallita: $e'); - throw Exception('Creazione negozio fallita: $e'); + throw Exception('$e'); } } @@ -120,7 +120,7 @@ class CoreRepository { return StaffMemberModel.fromMap(response); } catch (e) { debugPrint('Creazione profilo staff fallita: $e'); - throw Exception('Creazione profilo staff fallita: $e'); + throw Exception('$e'); } } diff --git a/lib/core/layout/app_shell.dart b/lib/core/layout/app_shell.dart index d5eb3af..dcf2bdd 100644 --- a/lib/core/layout/app_shell.dart +++ b/lib/core/layout/app_shell.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:flux/core/utils/extensions.dart'; import 'package:go_router/go_router.dart'; class AppShell extends StatelessWidget { @@ -43,21 +44,21 @@ class AppShell extends StatelessWidget { onDestinationSelected: (index) => _onItemTapped(index, context), labelType: NavigationRailLabelType.all, - destinations: const [ + destinations: [ NavigationRailDestination( icon: Icon(Icons.dashboard_outlined), selectedIcon: Icon(Icons.dashboard), - label: Text('Dashboard'), + label: Text(context.l10n.commonDashboard), ), NavigationRailDestination( icon: Icon(Icons.folder_special_outlined), selectedIcon: Icon(Icons.folder_special), - label: Text('Anagrafiche'), + label: Text(context.l10n.commonMasterData), ), NavigationRailDestination( icon: Icon(Icons.settings_outlined), selectedIcon: Icon(Icons.settings), - label: Text('Impostazioni'), + label: Text(context.l10n.commonSettings), ), ], ), @@ -73,21 +74,21 @@ class AppShell extends StatelessWidget { : NavigationBar( selectedIndex: currentIndex, onDestinationSelected: (index) => _onItemTapped(index, context), - destinations: const [ + destinations: [ NavigationDestination( icon: Icon(Icons.dashboard_outlined), selectedIcon: Icon(Icons.dashboard), - label: 'Dashboard', + label: context.l10n.commonDashboard, ), NavigationDestination( icon: Icon(Icons.folder_special_outlined), selectedIcon: Icon(Icons.folder_special), - label: 'Anagrafiche', + label: context.l10n.commonMasterData, ), NavigationDestination( icon: Icon(Icons.settings_outlined), selectedIcon: Icon(Icons.settings), - label: 'Impostazioni', + label: context.l10n.commonSettings, ), ], ), diff --git a/lib/core/routes/app_router.dart b/lib/core/routes/app_router.dart index 89c892f..2008f95 100644 --- a/lib/core/routes/app_router.dart +++ b/lib/core/routes/app_router.dart @@ -4,6 +4,7 @@ import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flux/core/blocs/session/session_cubit.dart'; import 'package:flux/core/data/core_repository.dart'; import 'package:flux/core/layout/app_shell.dart'; +import 'package:flux/core/utils/extensions.dart'; import 'package:flux/core/widgets/set_password_screen.dart'; import 'package:flux/features/auth/ui/auth_screen.dart'; import 'package:flux/features/customers/blocs/customer_files_bloc.dart'; @@ -14,6 +15,9 @@ import 'package:flux/features/customers/ui/customers_content.dart'; import 'package:flux/features/home/ui/home_screen.dart'; import 'package:flux/features/master_data/master_data_hub_content.dart'; import 'package:flux/features/master_data/products/ui/products_screen.dart'; +import 'package:flux/features/master_data/providers/ui/providers_master_data_screen.dart'; +import 'package:flux/features/master_data/staff/ui/staff_screen.dart'; +import 'package:flux/features/master_data/store/ui/stores_screen.dart'; import 'package:flux/features/onboarding/blocs/onboarding_cubit.dart'; import 'package:flux/features/onboarding/ui/onboarding_screen.dart'; import 'package:flux/features/services/blocs/service_files_bloc.dart'; @@ -96,19 +100,16 @@ class AppRouter { ), GoRoute( path: 'staff', // Diventa /master-data/staff - builder: (context, state) => - const Scaffold(body: Center(child: Text("Lista Staff"))), + builder: (context, state) => const StaffScreen(), ), GoRoute( path: 'stores', // Diventa /master-data/stores - builder: (context, state) => - const Scaffold(body: Center(child: Text("Lista Negozi"))), + builder: (context, state) => const StoresScreen(), ), GoRoute( path: 'providers', // Diventa /master-data/providers - builder: (context, state) => const Scaffold( - body: Center(child: Text("Lista Fornitori")), - ), + builder: (context, state) => + const ProvidersMasterDataScreen(), ), ], ), @@ -117,7 +118,7 @@ class AppRouter { GoRoute( path: '/settings', builder: (context, state) => Scaffold( - appBar: AppBar(title: const Text("Impostazioni")), + appBar: AppBar(title: Text(context.l10n.commonSettings)), body: Center( child: ElevatedButton.icon( onPressed: () => context.read().signOut(), diff --git a/lib/core/utils/app_message.dart b/lib/core/utils/app_message.dart new file mode 100644 index 0000000..66ce076 --- /dev/null +++ b/lib/core/utils/app_message.dart @@ -0,0 +1,20 @@ +import 'package:flutter/material.dart'; +import 'package:flux/core/utils/extensions.dart'; + +class AppMessage { + final String key; + final String? argument; + + const AppMessage({required this.key, this.argument}); + + String translatedMessage(BuildContext context) { + switch (key) { + case 'authCubitCheckEmailToConfirmAccount': + return context.l10n.authCubitCheckEmailToConfirmAccount; + case 'authCubitResetPasswordEmailSentTo': + return context.l10n.authCubitResetPasswordEmailSentTo(argument!); + default: + return 'empty message'; + } + } +} diff --git a/lib/core/widgets/image_viewer_widget.dart b/lib/core/widgets/image_viewer_widget.dart index cfb90d0..ef5f1bb 100644 --- a/lib/core/widgets/image_viewer_widget.dart +++ b/lib/core/widgets/image_viewer_widget.dart @@ -1,5 +1,6 @@ import 'dart:typed_data'; import 'package:flutter/material.dart'; +import 'package:flux/core/utils/extensions.dart'; import 'package:flux/core/utils/functions.dart'; class ImageViewerWidget extends StatelessWidget { @@ -36,8 +37,8 @@ class ImageViewerWidget extends StatelessWidget { return const CircularProgressIndicator(); } if (snapshot.hasError) { - return const Text( - "Errore caricamento immagine (Permessi negati?)", + return Text( + context.l10n.imageViewerWidgetErrorOpening, style: TextStyle(color: Colors.red), ); } diff --git a/lib/core/widgets/pdf_viewer_widget.dart b/lib/core/widgets/pdf_viewer_widget.dart index f83196a..6bcb85e 100644 --- a/lib/core/widgets/pdf_viewer_widget.dart +++ b/lib/core/widgets/pdf_viewer_widget.dart @@ -1,5 +1,6 @@ import 'dart:typed_data'; import 'package:flutter/material.dart'; +import 'package:flux/core/utils/extensions.dart'; import 'package:flux/core/utils/functions.dart'; import 'package:pdfx/pdfx.dart'; import 'package:internet_file/internet_file.dart'; @@ -74,13 +75,13 @@ class _PdfViewerWidgetState extends State { if (_errorMessage != null) { return Scaffold( appBar: AppBar(leading: const CloseButton()), - body: Center(child: Text("Errore: $_errorMessage")), + body: Center(child: Text(context.l10n.commonError(_errorMessage!))), ); } return Scaffold( appBar: AppBar( - title: const Text("Anteprima PDF"), + title: Text(context.l10n.pdfViewerAnteprimaPdf), leading: IconButton( icon: const Icon(Icons.close), onPressed: () => Navigator.pop(context), diff --git a/lib/core/widgets/qr_upload_dialog.dart b/lib/core/widgets/qr_upload_dialog.dart index 32ea978..65d37ee 100644 --- a/lib/core/widgets/qr_upload_dialog.dart +++ b/lib/core/widgets/qr_upload_dialog.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:flux/core/utils/extensions.dart'; import 'package:qr_flutter/qr_flutter.dart'; class QrUploadDialog extends StatelessWidget { @@ -84,7 +85,7 @@ class QrUploadDialog extends StatelessWidget { actions: [ TextButton( onPressed: () => Navigator.of(context).pop(), - child: const Text("CHIUDI"), + child: Text(context.l10n.commonClose), ), ], actionsAlignment: MainAxisAlignment.center, diff --git a/lib/core/widgets/set_password_screen.dart b/lib/core/widgets/set_password_screen.dart index 33e54b9..5f5d72d 100644 --- a/lib/core/widgets/set_password_screen.dart +++ b/lib/core/widgets/set_password_screen.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:flux/core/utils/extensions.dart'; import 'package:flux/core/widgets/flux_text_field.dart'; import 'package:get_it/get_it.dart'; import 'package:supabase_flutter/supabase_flutter.dart'; @@ -25,9 +26,7 @@ class _SetPasswordScreenState extends State { final newPassword = _passwordCtrl.text.trim(); if (newPassword.length < 6) { ScaffoldMessenger.of(context).showSnackBar( - const SnackBar( - content: Text("La password deve avere almeno 6 caratteri"), - ), + SnackBar(content: Text(context.l10n.setPasswordScreenAtLeast6Chars)), ); return; } @@ -43,23 +42,23 @@ class _SetPasswordScreenState extends State { // 2. Finito! Lo mandiamo alla home o facciamo ricaricare la sessione al SessionCubit if (mounted) { ScaffoldMessenger.of(context).showSnackBar( - const SnackBar( - content: Text("Password impostata! Benvenuto a bordo 🚀"), + SnackBar( + content: Text(context.l10n.setPasswordScreenPasswordSetWelcome), ), ); context.go('/'); // Rimandiamo al router principale } } on AuthException catch (e) { if (mounted) { - ScaffoldMessenger.of( - context, - ).showSnackBar(SnackBar(content: Text("Errore Auth: ${e.message}"))); + ScaffoldMessenger.of(context).showSnackBar( + SnackBar(content: Text(context.l10n.authError(e.message))), + ); } } catch (e) { if (mounted) { - ScaffoldMessenger.of( - context, - ).showSnackBar(SnackBar(content: Text("Errore: $e"))); + ScaffoldMessenger.of(context).showSnackBar( + SnackBar(content: Text(context.l10n.commonError(e.toString()))), + ); } } finally { if (mounted) setState(() => _isLoading = false); @@ -70,7 +69,7 @@ class _SetPasswordScreenState extends State { Widget build(BuildContext context) { return Scaffold( appBar: AppBar( - title: const Text("Benvenuto in FLUX!"), + title: Text(context.l10n.setPasswordScreenWelcomeInFlux), automaticallyImplyLeading: false, // Non può tornare indietro, deve mettere la password! ), @@ -82,21 +81,21 @@ class _SetPasswordScreenState extends State { children: [ const Icon(Icons.lock_reset, size: 80, color: Colors.blueAccent), const SizedBox(height: 24), - const Text( - "Imposta la tua Password", + Text( + context.l10n.setPasswordScreenSetPassword, textAlign: TextAlign.center, style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold), ), const SizedBox(height: 8), - const Text( - "Hai accettato l'invito. Scegli una password sicura per accedere in futuro.", + Text( + context.l10n.setPasswordInviteAcceptedChoosePassword, textAlign: TextAlign.center, style: TextStyle(color: Colors.grey), ), const SizedBox(height: 32), FluxTextField( controller: _passwordCtrl, - label: "Nuova Password", + label: context.l10n.commonNewPassword, icon: Icons.lock, isPassword: true, ), @@ -108,8 +107,8 @@ class _SetPasswordScreenState extends State { ), child: _isLoading ? const CircularProgressIndicator(color: Colors.white) - : const Text( - "SALVA E INIZIA", + : Text( + context.l10n.setPasswordScreenSaveAndStart, style: TextStyle(fontSize: 16), ), ), diff --git a/lib/features/auth/bloc/auth_cubit.dart b/lib/features/auth/bloc/auth_cubit.dart index 53411e0..b4faf4a 100644 --- a/lib/features/auth/bloc/auth_cubit.dart +++ b/lib/features/auth/bloc/auth_cubit.dart @@ -2,6 +2,7 @@ import 'package:equatable/equatable.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flux/core/blocs/session/session_cubit.dart'; import 'package:flux/core/data/constants.dart'; +import 'package:flux/core/utils/app_message.dart'; import 'package:get_it/get_it.dart'; import 'package:supabase_flutter/supabase_flutter.dart'; part 'auth_state.dart'; @@ -41,7 +42,9 @@ class AuthCubit extends Cubit { emit( state.copyWith( status: AuthStatus.initial, - infoMessage: "Controlla la tua email per confermare l'account!", + infoMessage: AppMessage( + key: 'authCubitCheckEmailToConfirmAccount', + ), ), ); } else { @@ -82,7 +85,10 @@ class AuthCubit extends Cubit { emit( state.copyWith( status: AuthStatus.pwResetSent, - infoMessage: "Email per reset password inviata a $email!", + infoMessage: AppMessage( + key: 'authCubitResetPasswordEmailSentTo', + argument: email, + ), ), ); } diff --git a/lib/features/auth/bloc/auth_state.dart b/lib/features/auth/bloc/auth_state.dart index f3c237e..5bb2dcf 100644 --- a/lib/features/auth/bloc/auth_state.dart +++ b/lib/features/auth/bloc/auth_state.dart @@ -6,7 +6,7 @@ class AuthState extends Equatable { final AuthStatus status; final bool isLoginMode; final String? errorMessage; - final String? infoMessage; + final AppMessage? infoMessage; const AuthState({ this.status = AuthStatus.initial, @@ -19,7 +19,7 @@ class AuthState extends Equatable { AuthStatus? status, bool? isLoginMode, String? errorMessage, - String? infoMessage, + AppMessage? infoMessage, }) { return AuthState( status: status ?? this.status, diff --git a/lib/features/auth/ui/auth_screen.dart b/lib/features/auth/ui/auth_screen.dart index f6327d8..428b6d7 100644 --- a/lib/features/auth/ui/auth_screen.dart +++ b/lib/features/auth/ui/auth_screen.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flux/core/theme/theme.dart'; +import 'package:flux/core/utils/extensions.dart'; import 'package:flux/core/widgets/flux_logo.dart'; import 'package:flux/core/widgets/flux_text_field.dart'; import 'package:flux/features/auth/bloc/auth_cubit.dart'; @@ -55,7 +56,7 @@ class _AuthScreenState extends State { if (state.infoMessage != null) { ScaffoldMessenger.of(context).showSnackBar( SnackBar( - content: Text(state.infoMessage!), + content: Text(state.infoMessage!.translatedMessage(context)), backgroundColor: Colors.blueAccent, // O context.accent ), ); @@ -77,7 +78,9 @@ class _AuthScreenState extends State { // --- TITOLO DINAMICO --- Text( - state.isLoginMode ? 'BENTORNATO' : 'CREA ACCOUNT', + state.isLoginMode + ? context.l10n.authScreenWelcomeBack + : context.l10n.authScreenCreateAccount, style: TextStyle( color: context.primaryText, fontSize: 24, @@ -88,8 +91,10 @@ class _AuthScreenState extends State { const SizedBox(height: 8), Text( state.isLoginMode - ? 'Accedi per gestire il tuo business' - : 'Inizia oggi a digitalizzare il tuo negozio', + ? context.l10n.authScreenLoginToManageYourBusiness + : context + .l10n + .authScreenStartTodayToDigitalizeYourStore, textAlign: TextAlign.center, style: TextStyle(color: context.secondaryText), ), @@ -97,7 +102,7 @@ class _AuthScreenState extends State { // --- CAMPI INPUT --- FluxTextField( - label: 'Email Aziendale', + label: context.l10n.authScreenBusinessEmail, icon: Icons.email_outlined, controller: _emailController, keyboardType: TextInputType.emailAddress, @@ -130,7 +135,9 @@ class _AuthScreenState extends State { ), ) : Text( - state.isLoginMode ? 'ACCEDI' : 'REGISTRATI', + state.isLoginMode + ? context.l10n.authScreenLogin + : context.l10n.authScreenSignUp, style: const TextStyle( fontWeight: FontWeight.bold, ), @@ -147,12 +154,15 @@ class _AuthScreenState extends State { child: RichText( text: TextSpan( text: state.isLoginMode - ? "Non hai un account? " - : "Hai già un account? ", + ? context.l10n.authScreenDontHaveAccount + : context.l10n.authScreenAlreadyHaveAccount, style: TextStyle(color: context.secondaryText), children: [ TextSpan( - text: state.isLoginMode ? "Registrati" : "Accedi", + text: state.isLoginMode + ? context.l10n.authScreenSignUp + : context.l10n.authScreenLogin, + style: TextStyle( color: context.accent, fontWeight: FontWeight.bold, @@ -169,7 +179,7 @@ class _AuthScreenState extends State { .read() .requestPasswordReset(_emailController.text.trim()), child: Text( - 'Pw dimenticata/Invito scaduto?', + context.l10n.authScreenForgotPassword, style: TextStyle( color: context.accent, fontWeight: FontWeight.bold, diff --git a/lib/features/company/bloc/company_state.dart b/lib/features/company/bloc/company_state.dart index 5cef955..1460579 100644 --- a/lib/features/company/bloc/company_state.dart +++ b/lib/features/company/bloc/company_state.dart @@ -22,5 +22,5 @@ class CompanyState extends Equatable { } @override - List get props => [status, errorMessage]; + List get props => [status, errorMessage, company]; } diff --git a/lib/features/company/data/company_repository.dart b/lib/features/company/data/company_repository.dart index 2c70f4f..5a6bb17 100644 --- a/lib/features/company/data/company_repository.dart +++ b/lib/features/company/data/company_repository.dart @@ -17,7 +17,7 @@ class CompanyRepository { } on PostgrestException catch (e) { throw e.message; } catch (e) { - throw 'Errore imprevisto durante la creazione dell\'azienda'; + throw e.toString(); } } diff --git a/lib/features/company/ui/create_company_screen.dart b/lib/features/company/ui/create_company_screen.dart index e92e7d2..c5447b3 100644 --- a/lib/features/company/ui/create_company_screen.dart +++ b/lib/features/company/ui/create_company_screen.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:flux/core/utils/extensions.dart'; import 'package:flux/features/company/bloc/company_bloc.dart'; import 'package:flux/core/blocs/session/session_cubit.dart'; import 'package:flux/core/theme/theme.dart'; @@ -69,7 +70,7 @@ class _CreateCompanyScreenState extends State { Widget build(BuildContext context) { return Scaffold( appBar: AppBar( - title: const Text('Configurazione Azienda'), + title: Text(context.l10n.createCompanyScreenCompanyConfiguration), actions: [ IconButton( icon: const Icon(Icons.logout_rounded), @@ -98,7 +99,7 @@ class _CreateCompanyScreenState extends State { ScaffoldMessenger.of(context).showSnackBar( SnackBar( content: Text( - state.errorMessage ?? 'Errore durante il salvataggio', + state.errorMessage ?? context.l10n.commonSavingError, ), backgroundColor: Colors.redAccent, ), @@ -118,10 +119,12 @@ class _CreateCompanyScreenState extends State { const SizedBox(height: 32), // --- SEZIONE 1: IDENTITÀ FISCALE --- - _SectionTitle(title: 'DATI FISCALI'), + _SectionTitle( + title: context.l10n.createCompanyScreenFiscalData, + ), const SizedBox(height: 16), FluxTextField( - label: 'Ragione Sociale', + label: context.l10n.createCompanyScreenCompanyName, icon: Icons.business, controller: _ragioneSocialeController, ), @@ -130,7 +133,7 @@ class _CreateCompanyScreenState extends State { children: [ Expanded( child: FluxTextField( - label: 'Partita IVA', + label: context.l10n.createCompanyScreenVatId, icon: Icons.numbers, controller: _pIvaController, ), @@ -138,7 +141,7 @@ class _CreateCompanyScreenState extends State { const SizedBox(width: 12), Expanded( child: FluxTextField( - label: 'Codice Fiscale', + label: context.l10n.createCompanyScreenFiscalCode, icon: Icons.badge_outlined, controller: _cfController, ), @@ -147,7 +150,7 @@ class _CreateCompanyScreenState extends State { ), const SizedBox(height: 16), FluxTextField( - label: 'Codice Univoco (SDI) / PEC', + label: context.l10n.createCompanyScreenSdiPec, icon: Icons.send_and_archive_outlined, controller: _univocoController, ), @@ -155,10 +158,13 @@ class _CreateCompanyScreenState extends State { const SizedBox(height: 32), // --- SEZIONE 2: SEDE LEGALE --- - _SectionTitle(title: 'SEDE LEGALE'), + _SectionTitle( + title: + context.l10n.createCompanyScreenCompanyLegalAddress, + ), const SizedBox(height: 16), FluxTextField( - label: 'Indirizzo e n. civico', + label: context.l10n.commonAddress, icon: Icons.home_work_outlined, controller: _indirizzoController, ), @@ -168,7 +174,7 @@ class _CreateCompanyScreenState extends State { Expanded( flex: 2, child: FluxTextField( - label: 'Città', + label: context.l10n.commonCity, icon: Icons.location_city, controller: _cittaController, ), @@ -176,7 +182,7 @@ class _CreateCompanyScreenState extends State { const SizedBox(width: 12), Expanded( child: FluxTextField( - label: 'CAP', + label: context.l10n.commonZipCode, icon: Icons.map_outlined, controller: _capController, ), @@ -184,7 +190,7 @@ class _CreateCompanyScreenState extends State { const SizedBox(width: 12), Expanded( child: FluxTextField( - label: 'Prov', + label: context.l10n.commonProvince, icon: Icons.explore_outlined, controller: _provinciaController, ), @@ -232,7 +238,7 @@ class _CreateCompanyScreenState extends State { Icon(Icons.cloud_upload_outlined, color: context.accent, size: 32), const SizedBox(height: 12), Text( - 'Carica Logo Aziendale', + context.l10n.createCompanyScreenUploadLogo, style: TextStyle( color: context.primaryText, fontWeight: FontWeight.bold, @@ -240,7 +246,7 @@ class _CreateCompanyScreenState extends State { ), const SizedBox(height: 4), Text( - 'Verrà usato per le tue stampe e ricevute', + context.l10n.createCompanyScreenWillBeUsedForReceipts, textAlign: TextAlign.center, style: TextStyle(color: context.secondaryText, fontSize: 12), ), @@ -259,7 +265,7 @@ class _CreateCompanyScreenState extends State { : () => _onSave(), child: state.status == CompanyStatus.loading ? const CircularProgressIndicator() - : const Text('SALVA AZIENDA'), + : Text(context.l10n.createCompanyScreenSaveCompany), ), ); } @@ -282,7 +288,7 @@ class _CreateCompanyScreenState extends State { ), const SizedBox(height: 24), Text( - 'Configura la tua Azienda', + context.l10n.createCompanyScreenSetupYourCompany, style: Theme.of(context).textTheme.headlineMedium?.copyWith( fontWeight: FontWeight.bold, color: context.primaryText, @@ -290,7 +296,7 @@ class _CreateCompanyScreenState extends State { ), const SizedBox(height: 12), Text( - 'FLUX ha bisogno dei tuoi dati fiscali per gestire correttamente le fatturazioni e le attivazioni dei tuoi negozi.', + context.l10n.createCompanyScreenFluxNeedsYourFiscalData, style: TextStyle( color: context.secondaryText, fontSize: 15, diff --git a/lib/features/customers/data/customer_repository.dart b/lib/features/customers/data/customer_repository.dart index daf61c0..0831685 100644 --- a/lib/features/customers/data/customer_repository.dart +++ b/lib/features/customers/data/customer_repository.dart @@ -21,7 +21,7 @@ class CustomerRepository { .single(); return CustomerModel.fromMap(response); } catch (e) { - throw 'Errore durante il salvataggio del cliente: $e'; + throw '$e'; } } @@ -35,7 +35,7 @@ class CustomerRepository { .single(); return CustomerModel.fromMap(response); } catch (e) { - throw 'Errore durante la modifica del cliente: $e'; + throw '$e'; } } @@ -54,7 +54,7 @@ class CustomerRepository { return (response as List).map((c) => CustomerModel.fromMap(c)).toList(); } catch (e) { - throw 'Errore nel recupero clienti'; + throw '$e'; } } @@ -102,7 +102,7 @@ class CustomerRepository { .map((f) => CustomerFileModel.fromMap(f)) .toList(); } catch (e) { - throw 'Errore recupero file: $e'; + throw '$e'; } } @@ -131,7 +131,7 @@ class CustomerRepository { try { // Usiamo bytes invece del path per massima compatibilità if (pickedFile.bytes == null && pickedFile.path == null) { - throw 'Impossibile leggere il contenuto del file'; + throw 'File read error'; } // Se siamo su desktop/mobile abbiamo il path, su web abbiamo i bytes @@ -153,7 +153,7 @@ class CustomerRepository { return CustomerFileModel.fromMap(response); } catch (e) { - throw 'Errore durante l\'upload: $e'; + throw '$e'; } } @@ -186,14 +186,10 @@ class CustomerRepository { // 3. Cancellazione MASSIVA dallo Storage await _supabase.storage.from('documents').remove(storagePaths); - - debugPrint("Eliminati con successo ${files.length} file."); } on PostgrestException catch (e) { - debugPrint("Errore DB: ${e.message}"); - throw 'Errore database: ${e.message}'; + throw e.message; } catch (e) { - debugPrint("Errore generico: $e"); - throw 'Errore durante l\'eliminazione dei file: $e'; + throw '$e'; } } } diff --git a/lib/features/home/ui/home_screen.dart b/lib/features/home/ui/home_screen.dart index e254aeb..0d73cfa 100644 --- a/lib/features/home/ui/home_screen.dart +++ b/lib/features/home/ui/home_screen.dart @@ -58,31 +58,31 @@ class HomeScreen extends StatelessWidget { ), delegate: SliverChildListDelegate([ _buildDashboardWidget( - title: context.l10n.expiring_contracts, + title: context.l10n.homeExpiringContracts, icon: Icons.assignment_late_outlined, color: Colors.orange, context: context, ), _buildDashboardWidget( - title: context.l10n.sticky_notes, + title: context.l10n.commonStickyNotes, icon: Icons.sticky_note_2_outlined, color: Colors.yellow.shade700, context: context, ), _buildDashboardWidget( - title: context.l10n.my_tasks, + title: context.l10n.homeMyTasks, icon: Icons.check_box_outlined, color: Colors.green, context: context, ), _buildDashboardWidget( - title: context.l10n.latestServices, + title: context.l10n.homeLatestServices, icon: Icons.design_services_outlined, color: Colors.blue, context: context, ), _buildDashboardWidget( - title: 'Ultime Assistenze', + title: context.l10n.homeLatestServiceTickets, icon: Icons.support_agent_outlined, color: Colors.purple, context: context, @@ -118,7 +118,7 @@ class HomeScreen extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - "Bentornato, ${user!.name}! 👋", + context.l10n.homeWelcomeBack(user?.name ?? "Utente"), style: theme.textTheme.headlineMedium?.copyWith( fontWeight: FontWeight.bold, letterSpacing: -0.5, @@ -152,7 +152,7 @@ class HomeScreen extends StatelessWidget { Icon(Icons.storefront, size: 16, color: context.primary), const SizedBox(width: 8), Text( - currentStore?.nome ?? "Nessun negozio", + currentStore?.nome ?? context.l10n.homeNoStoreFound, style: TextStyle( fontWeight: FontWeight.w600, color: context.primary, @@ -184,7 +184,7 @@ class HomeScreen extends StatelessWidget { children: [ QuickActionButton( icon: Icons.add, - label: "Servizio", + label: context.l10n.commonService, color: Colors.blue, onTap: () { // Entriamo nel form! Nessun parametro extra = Nuovo Servizio @@ -194,7 +194,7 @@ class HomeScreen extends StatelessWidget { const SizedBox(width: 12), QuickActionButton( icon: Icons.handyman, - label: "Assistenza", + label: context.l10n.homeNewServiceTicket, color: Colors.redAccent, onTap: () { // TODO: Quando avrai la rotta per la nuova assistenza @@ -204,7 +204,7 @@ class HomeScreen extends StatelessWidget { const SizedBox(width: 12), QuickActionButton( icon: Icons.note_add, - label: "Nota", + label: context.l10n.commonNote, color: Colors.amber, onTap: () { // TODO: Quando faremo il modale/pagina delle note @@ -213,7 +213,7 @@ class HomeScreen extends StatelessWidget { const SizedBox(width: 12), QuickActionButton( icon: Icons.task_alt, - label: "Task", + label: context.l10n.commonTask, color: Colors.teal, onTap: () { // TODO: Quando faremo i task @@ -281,7 +281,7 @@ class HomeScreen extends StatelessWidget { const Spacer(), Center( child: Text( - "(Coming Soon)", + context.l10n.commonComingSoon, style: TextStyle( color: context.secondaryText.withValues(alpha: 0.7), fontStyle: FontStyle.italic, diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb deleted file mode 100644 index 84c90f5..0000000 --- a/lib/l10n/app_en.arb +++ /dev/null @@ -1,13 +0,0 @@ -{ - "@@locale": "en", - "welcomeBack": "Welcome back, {name}! 👋", - "latestServices": "Latest Services", - "masterData": "Master Data", - "settings": "Settings", - "newService": "Service", - "expiring_contracts": "Expiring Contracts", - "sticky_notes": "Sticky Notes", - "my_tasks": "My Tasks", - "latest_service_tickets": "Latest service tickets" - -} \ No newline at end of file diff --git a/lib/l10n/app_it.arb b/lib/l10n/app_it.arb index b6ab9cc..24055c9 100644 --- a/lib/l10n/app_it.arb +++ b/lib/l10n/app_it.arb @@ -1,20 +1,90 @@ { "@@locale": "it", - "welcomeBack": "Bentornato, {name}! 👋", - "@welcomeBack": { + "@authCubitResetPasswordEmailSentTo": { + "placeholders": { + "email": { + "type": "String" + } + } + }, + "@authError": { + "placeholders": { + "message": { + "type": "String" + } + } + }, + "@commonComingSoon": {}, + "@commonError": { + "placeholders": { + "error": { + "type": "String" + } + } + }, + "@homeWelcomeBack": { "placeholders": { "name": { "type": "String" } } }, - "latestServices": "Ultimi Servizi", - "masterData": "Anagrafiche", - "settings": "Impostazioni", - "newService": "Servizio", - "expiring_contracts": "Contratti in scadenza", - "sticky_notes": "Sticky Notes", - "my_tasks": "Mie Attività", - "latest_service_tickets": "Ultime assistenze" - + "authCubitCheckEmailToConfirmAccount": "Controlla la tua email per confermare l'account!", + "authCubitResetPasswordEmailSentTo": "Email per reset password inviata a {email}!", + "authError": "Errore di autenticazione: {message}", + "authScreenAlreadyHaveAccount": "Hai già un account?", + "authScreenBusinessEmail": "Email aziendale", + "authScreenCreateAccount": "CREA ACCOUNT", + "authScreenDontHaveAccount": "Non hai un account?", + "authScreenForgotPassword": "Password dimenticata/Invito scaduto?", + "authScreenLogin": "LOGIN", + "authScreenLoginToManageYourBusiness": "Accedi per gestire il tuo business", + "authScreenSignUp": "REGISTRATI", + "authScreenStartTodayToDigitalizeYourStore": "Inizia oggi a digitalizzare il tuo negozio", + "authScreenWelcomeBack": "BENTORNATO", + "commonClose": "Chiudi", + "commonComingSoon": "Coming soon", + "commonDashboard": "Panoramica", + "commonError": "Si è verificato un errore: {error}", + "commonMasterData": "Anagrafiche", + "commonNewPassword": "Nuova Password", + "commonNote": "Nota", + "commonSave": "Salva", + "commonService": "Servizio", + "commonSettings": "Impostazioni", + "commonStickyNotes": "Sticky Notes", + "commonTask": "Attività", + "homeExpiringContracts": "Contratti in scadenza", + "homeLatestServiceTickets": "Ultime assistenze", + "homeLatestServices": "Ultimi Servizi", + "homeMyTasks": "Mie Attività", + "homeNewServiceTicket": "Nuova assistenza", + "homeNoStoreFound": "Nessun negozio trovato", + "homeWelcomeBack": "Bentornato, {name}! 👋", + "imageViewerWidgetErrorOpening": "Errore durante l'apertura dell'immagine", + "pdfViewerAnteprimaPdf": "Anteprima PDF", + "setPasswordInviteAcceptedChoosePassword": "Hai accettato l'invito. Scegli una password sicura per accedere in futuro.", + "setPasswordScreenAtLeast6Chars": "La password deve avere almeno 6 caratteri", + "setPasswordScreenPasswordSetWelcome": "Password impostata! Benvenuto a bordo 🚀", + "setPasswordScreenSaveAndStart": "SALVA E INIZIA", + "setPasswordScreenSetPassword": "Imposta una nuova Password", + "setPasswordScreenWelcomeInFlux": "Benvenuto in FLUX!", + "createCompanyScreenCompanyConfiguration": "Configurazione Azienda", + "commonSavingError": "Errore durante il salvataggio", + "createCompanyScreenFiscalData": "DATI FISCALI", + "createCompanyScreenCompanyName": "Ragione Sociale", + "createCompanyScreenVatId": "Partita IVA", + "createCompanyScreenFiscalCode": "Codice Fiscale", + "createCompanyScreenSdiPec": "Codice Univoco (SDI) / PEC", + "createCompanyScreenCompanyLegalAddress": "SEDE LEGALE", + "commonAddress": "Indirizzo e n. civico", + "commonCity": "Città", + "commonZipCode": "CAP", + "commonProvince": "Prov", + "commonCountry": "Paese", + "createCompanyScreenUploadLogo": "Carica Logo Aziendale", + "createCompanyScreenWillBeUsedForReceipts": "Verrà utilizzato per le tue stampe e ricevute", + "createCompanyScreenSaveCompany": "SALVA AZIENDA", + "createCompanyScreenSetupYourCompany": "Configura la tua Azienda", + "createCompanyScreenFluxNeedsYourFiscalData": "FLUX ha bisogno dei tuoi dati fiscali per gestire correttamente le fatturazioni e le attivazioni dei tuoi negozi." } \ No newline at end of file diff --git a/lib/l10n/app_localizations.dart b/lib/l10n/app_localizations.dart index 58547fa..c2b13f8 100644 --- a/lib/l10n/app_localizations.dart +++ b/lib/l10n/app_localizations.dart @@ -5,7 +5,6 @@ import 'package:flutter/widgets.dart'; import 'package:flutter_localizations/flutter_localizations.dart'; import 'package:intl/intl.dart' as intl; -import 'app_localizations_en.dart'; import 'app_localizations_it.dart'; // ignore_for_file: type=lint @@ -93,64 +92,355 @@ abstract class AppLocalizations { ]; /// A list of this localizations delegate's supported locales. - static const List supportedLocales = [ - Locale('en'), - Locale('it'), - ]; + static const List supportedLocales = [Locale('it')]; - /// No description provided for @welcomeBack. + /// No description provided for @authCubitCheckEmailToConfirmAccount. /// /// In it, this message translates to: - /// **'Bentornato, {name}! 👋'** - String welcomeBack(String name); + /// **'Controlla la tua email per confermare l\'account!'** + String get authCubitCheckEmailToConfirmAccount; - /// No description provided for @latestServices. + /// No description provided for @authCubitResetPasswordEmailSentTo. /// /// In it, this message translates to: - /// **'Ultimi Servizi'** - String get latestServices; + /// **'Email per reset password inviata a {email}!'** + String authCubitResetPasswordEmailSentTo(String email); - /// No description provided for @masterData. + /// No description provided for @authError. + /// + /// In it, this message translates to: + /// **'Errore di autenticazione: {message}'** + String authError(String message); + + /// No description provided for @authScreenAlreadyHaveAccount. + /// + /// In it, this message translates to: + /// **'Hai già un account?'** + String get authScreenAlreadyHaveAccount; + + /// No description provided for @authScreenBusinessEmail. + /// + /// In it, this message translates to: + /// **'Email aziendale'** + String get authScreenBusinessEmail; + + /// No description provided for @authScreenCreateAccount. + /// + /// In it, this message translates to: + /// **'CREA ACCOUNT'** + String get authScreenCreateAccount; + + /// No description provided for @authScreenDontHaveAccount. + /// + /// In it, this message translates to: + /// **'Non hai un account?'** + String get authScreenDontHaveAccount; + + /// No description provided for @authScreenForgotPassword. + /// + /// In it, this message translates to: + /// **'Password dimenticata/Invito scaduto?'** + String get authScreenForgotPassword; + + /// No description provided for @authScreenLogin. + /// + /// In it, this message translates to: + /// **'LOGIN'** + String get authScreenLogin; + + /// No description provided for @authScreenLoginToManageYourBusiness. + /// + /// In it, this message translates to: + /// **'Accedi per gestire il tuo business'** + String get authScreenLoginToManageYourBusiness; + + /// No description provided for @authScreenSignUp. + /// + /// In it, this message translates to: + /// **'REGISTRATI'** + String get authScreenSignUp; + + /// No description provided for @authScreenStartTodayToDigitalizeYourStore. + /// + /// In it, this message translates to: + /// **'Inizia oggi a digitalizzare il tuo negozio'** + String get authScreenStartTodayToDigitalizeYourStore; + + /// No description provided for @authScreenWelcomeBack. + /// + /// In it, this message translates to: + /// **'BENTORNATO'** + String get authScreenWelcomeBack; + + /// No description provided for @commonClose. + /// + /// In it, this message translates to: + /// **'Chiudi'** + String get commonClose; + + /// No description provided for @commonComingSoon. + /// + /// In it, this message translates to: + /// **'Coming soon'** + String get commonComingSoon; + + /// No description provided for @commonDashboard. + /// + /// In it, this message translates to: + /// **'Panoramica'** + String get commonDashboard; + + /// No description provided for @commonError. + /// + /// In it, this message translates to: + /// **'Si è verificato un errore: {error}'** + String commonError(String error); + + /// No description provided for @commonMasterData. /// /// In it, this message translates to: /// **'Anagrafiche'** - String get masterData; + String get commonMasterData; - /// No description provided for @settings. + /// No description provided for @commonNewPassword. /// /// In it, this message translates to: - /// **'Impostazioni'** - String get settings; + /// **'Nuova Password'** + String get commonNewPassword; - /// No description provided for @newService. + /// No description provided for @commonNote. + /// + /// In it, this message translates to: + /// **'Nota'** + String get commonNote; + + /// No description provided for @commonSave. + /// + /// In it, this message translates to: + /// **'Salva'** + String get commonSave; + + /// No description provided for @commonService. /// /// In it, this message translates to: /// **'Servizio'** - String get newService; + String get commonService; - /// No description provided for @expiring_contracts. + /// No description provided for @commonSettings. /// /// In it, this message translates to: - /// **'Contratti in scadenza'** - String get expiring_contracts; + /// **'Impostazioni'** + String get commonSettings; - /// No description provided for @sticky_notes. + /// No description provided for @commonStickyNotes. /// /// In it, this message translates to: /// **'Sticky Notes'** - String get sticky_notes; + String get commonStickyNotes; - /// No description provided for @my_tasks. + /// No description provided for @commonTask. /// /// In it, this message translates to: - /// **'Mie Attività'** - String get my_tasks; + /// **'Attività'** + String get commonTask; - /// No description provided for @latest_service_tickets. + /// No description provided for @homeExpiringContracts. + /// + /// In it, this message translates to: + /// **'Contratti in scadenza'** + String get homeExpiringContracts; + + /// No description provided for @homeLatestServiceTickets. /// /// In it, this message translates to: /// **'Ultime assistenze'** - String get latest_service_tickets; + String get homeLatestServiceTickets; + + /// No description provided for @homeLatestServices. + /// + /// In it, this message translates to: + /// **'Ultimi Servizi'** + String get homeLatestServices; + + /// No description provided for @homeMyTasks. + /// + /// In it, this message translates to: + /// **'Mie Attività'** + String get homeMyTasks; + + /// No description provided for @homeNewServiceTicket. + /// + /// In it, this message translates to: + /// **'Nuova assistenza'** + String get homeNewServiceTicket; + + /// No description provided for @homeNoStoreFound. + /// + /// In it, this message translates to: + /// **'Nessun negozio trovato'** + String get homeNoStoreFound; + + /// No description provided for @homeWelcomeBack. + /// + /// In it, this message translates to: + /// **'Bentornato, {name}! 👋'** + String homeWelcomeBack(String name); + + /// No description provided for @imageViewerWidgetErrorOpening. + /// + /// In it, this message translates to: + /// **'Errore durante l\'apertura dell\'immagine'** + String get imageViewerWidgetErrorOpening; + + /// No description provided for @pdfViewerAnteprimaPdf. + /// + /// In it, this message translates to: + /// **'Anteprima PDF'** + String get pdfViewerAnteprimaPdf; + + /// No description provided for @setPasswordInviteAcceptedChoosePassword. + /// + /// In it, this message translates to: + /// **'Hai accettato l\'invito. Scegli una password sicura per accedere in futuro.'** + String get setPasswordInviteAcceptedChoosePassword; + + /// No description provided for @setPasswordScreenAtLeast6Chars. + /// + /// In it, this message translates to: + /// **'La password deve avere almeno 6 caratteri'** + String get setPasswordScreenAtLeast6Chars; + + /// No description provided for @setPasswordScreenPasswordSetWelcome. + /// + /// In it, this message translates to: + /// **'Password impostata! Benvenuto a bordo 🚀'** + String get setPasswordScreenPasswordSetWelcome; + + /// No description provided for @setPasswordScreenSaveAndStart. + /// + /// In it, this message translates to: + /// **'SALVA E INIZIA'** + String get setPasswordScreenSaveAndStart; + + /// No description provided for @setPasswordScreenSetPassword. + /// + /// In it, this message translates to: + /// **'Imposta una nuova Password'** + String get setPasswordScreenSetPassword; + + /// No description provided for @setPasswordScreenWelcomeInFlux. + /// + /// In it, this message translates to: + /// **'Benvenuto in FLUX!'** + String get setPasswordScreenWelcomeInFlux; + + /// No description provided for @createCompanyScreenCompanyConfiguration. + /// + /// In it, this message translates to: + /// **'Configurazione Azienda'** + String get createCompanyScreenCompanyConfiguration; + + /// No description provided for @commonSavingError. + /// + /// In it, this message translates to: + /// **'Errore durante il salvataggio'** + String get commonSavingError; + + /// No description provided for @createCompanyScreenFiscalData. + /// + /// In it, this message translates to: + /// **'DATI FISCALI'** + String get createCompanyScreenFiscalData; + + /// No description provided for @createCompanyScreenCompanyName. + /// + /// In it, this message translates to: + /// **'Ragione Sociale'** + String get createCompanyScreenCompanyName; + + /// No description provided for @createCompanyScreenVatId. + /// + /// In it, this message translates to: + /// **'Partita IVA'** + String get createCompanyScreenVatId; + + /// No description provided for @createCompanyScreenFiscalCode. + /// + /// In it, this message translates to: + /// **'Codice Fiscale'** + String get createCompanyScreenFiscalCode; + + /// No description provided for @createCompanyScreenSdiPec. + /// + /// In it, this message translates to: + /// **'Codice Univoco (SDI) / PEC'** + String get createCompanyScreenSdiPec; + + /// No description provided for @createCompanyScreenCompanyLegalAddress. + /// + /// In it, this message translates to: + /// **'SEDE LEGALE'** + String get createCompanyScreenCompanyLegalAddress; + + /// No description provided for @commonAddress. + /// + /// In it, this message translates to: + /// **'Indirizzo e n. civico'** + String get commonAddress; + + /// No description provided for @commonCity. + /// + /// In it, this message translates to: + /// **'Città'** + String get commonCity; + + /// No description provided for @commonZipCode. + /// + /// In it, this message translates to: + /// **'CAP'** + String get commonZipCode; + + /// No description provided for @commonProvince. + /// + /// In it, this message translates to: + /// **'Prov'** + String get commonProvince; + + /// No description provided for @commonCountry. + /// + /// In it, this message translates to: + /// **'Paese'** + String get commonCountry; + + /// No description provided for @createCompanyScreenUploadLogo. + /// + /// In it, this message translates to: + /// **'Carica Logo Aziendale'** + String get createCompanyScreenUploadLogo; + + /// No description provided for @createCompanyScreenWillBeUsedForReceipts. + /// + /// In it, this message translates to: + /// **'Verrà utilizzato per le tue stampe e ricevute'** + String get createCompanyScreenWillBeUsedForReceipts; + + /// No description provided for @createCompanyScreenSaveCompany. + /// + /// In it, this message translates to: + /// **'SALVA AZIENDA'** + String get createCompanyScreenSaveCompany; + + /// No description provided for @createCompanyScreenSetupYourCompany. + /// + /// In it, this message translates to: + /// **'Configura la tua Azienda'** + String get createCompanyScreenSetupYourCompany; + + /// No description provided for @createCompanyScreenFluxNeedsYourFiscalData. + /// + /// In it, this message translates to: + /// **'FLUX ha bisogno dei tuoi dati fiscali per gestire correttamente le fatturazioni e le attivazioni dei tuoi negozi.'** + String get createCompanyScreenFluxNeedsYourFiscalData; } class _AppLocalizationsDelegate @@ -164,7 +454,7 @@ class _AppLocalizationsDelegate @override bool isSupported(Locale locale) => - ['en', 'it'].contains(locale.languageCode); + ['it'].contains(locale.languageCode); @override bool shouldReload(_AppLocalizationsDelegate old) => false; @@ -173,8 +463,6 @@ class _AppLocalizationsDelegate AppLocalizations lookupAppLocalizations(Locale locale) { // Lookup logic when only language code is specified. switch (locale.languageCode) { - case 'en': - return AppLocalizationsEn(); case 'it': return AppLocalizationsIt(); } diff --git a/lib/l10n/app_localizations_en.dart b/lib/l10n/app_localizations_en.dart deleted file mode 100644 index f5dea85..0000000 --- a/lib/l10n/app_localizations_en.dart +++ /dev/null @@ -1,39 +0,0 @@ -// ignore: unused_import -import 'package:intl/intl.dart' as intl; -import 'app_localizations.dart'; - -// ignore_for_file: type=lint - -/// The translations for English (`en`). -class AppLocalizationsEn extends AppLocalizations { - AppLocalizationsEn([String locale = 'en']) : super(locale); - - @override - String welcomeBack(String name) { - return 'Welcome back, $name! 👋'; - } - - @override - String get latestServices => 'Latest Services'; - - @override - String get masterData => 'Master Data'; - - @override - String get settings => 'Settings'; - - @override - String get newService => 'Service'; - - @override - String get expiring_contracts => 'Expiring Contracts'; - - @override - String get sticky_notes => 'Sticky Notes'; - - @override - String get my_tasks => 'My Tasks'; - - @override - String get latest_service_tickets => 'Latest service tickets'; -} diff --git a/lib/l10n/app_localizations_it.dart b/lib/l10n/app_localizations_it.dart index 434a39d..5ca322c 100644 --- a/lib/l10n/app_localizations_it.dart +++ b/lib/l10n/app_localizations_it.dart @@ -9,31 +9,194 @@ class AppLocalizationsIt extends AppLocalizations { AppLocalizationsIt([String locale = 'it']) : super(locale); @override - String welcomeBack(String name) { + String get authCubitCheckEmailToConfirmAccount => + 'Controlla la tua email per confermare l\'account!'; + + @override + String authCubitResetPasswordEmailSentTo(String email) { + return 'Email per reset password inviata a $email!'; + } + + @override + String authError(String message) { + return 'Errore di autenticazione: $message'; + } + + @override + String get authScreenAlreadyHaveAccount => 'Hai già un account?'; + + @override + String get authScreenBusinessEmail => 'Email aziendale'; + + @override + String get authScreenCreateAccount => 'CREA ACCOUNT'; + + @override + String get authScreenDontHaveAccount => 'Non hai un account?'; + + @override + String get authScreenForgotPassword => 'Password dimenticata/Invito scaduto?'; + + @override + String get authScreenLogin => 'LOGIN'; + + @override + String get authScreenLoginToManageYourBusiness => + 'Accedi per gestire il tuo business'; + + @override + String get authScreenSignUp => 'REGISTRATI'; + + @override + String get authScreenStartTodayToDigitalizeYourStore => + 'Inizia oggi a digitalizzare il tuo negozio'; + + @override + String get authScreenWelcomeBack => 'BENTORNATO'; + + @override + String get commonClose => 'Chiudi'; + + @override + String get commonComingSoon => 'Coming soon'; + + @override + String get commonDashboard => 'Panoramica'; + + @override + String commonError(String error) { + return 'Si è verificato un errore: $error'; + } + + @override + String get commonMasterData => 'Anagrafiche'; + + @override + String get commonNewPassword => 'Nuova Password'; + + @override + String get commonNote => 'Nota'; + + @override + String get commonSave => 'Salva'; + + @override + String get commonService => 'Servizio'; + + @override + String get commonSettings => 'Impostazioni'; + + @override + String get commonStickyNotes => 'Sticky Notes'; + + @override + String get commonTask => 'Attività'; + + @override + String get homeExpiringContracts => 'Contratti in scadenza'; + + @override + String get homeLatestServiceTickets => 'Ultime assistenze'; + + @override + String get homeLatestServices => 'Ultimi Servizi'; + + @override + String get homeMyTasks => 'Mie Attività'; + + @override + String get homeNewServiceTicket => 'Nuova assistenza'; + + @override + String get homeNoStoreFound => 'Nessun negozio trovato'; + + @override + String homeWelcomeBack(String name) { return 'Bentornato, $name! 👋'; } @override - String get latestServices => 'Ultimi Servizi'; + String get imageViewerWidgetErrorOpening => + 'Errore durante l\'apertura dell\'immagine'; @override - String get masterData => 'Anagrafiche'; + String get pdfViewerAnteprimaPdf => 'Anteprima PDF'; @override - String get settings => 'Impostazioni'; + String get setPasswordInviteAcceptedChoosePassword => + 'Hai accettato l\'invito. Scegli una password sicura per accedere in futuro.'; @override - String get newService => 'Servizio'; + String get setPasswordScreenAtLeast6Chars => + 'La password deve avere almeno 6 caratteri'; @override - String get expiring_contracts => 'Contratti in scadenza'; + String get setPasswordScreenPasswordSetWelcome => + 'Password impostata! Benvenuto a bordo 🚀'; @override - String get sticky_notes => 'Sticky Notes'; + String get setPasswordScreenSaveAndStart => 'SALVA E INIZIA'; @override - String get my_tasks => 'Mie Attività'; + String get setPasswordScreenSetPassword => 'Imposta una nuova Password'; @override - String get latest_service_tickets => 'Ultime assistenze'; + String get setPasswordScreenWelcomeInFlux => 'Benvenuto in FLUX!'; + + @override + String get createCompanyScreenCompanyConfiguration => + 'Configurazione Azienda'; + + @override + String get commonSavingError => 'Errore durante il salvataggio'; + + @override + String get createCompanyScreenFiscalData => 'DATI FISCALI'; + + @override + String get createCompanyScreenCompanyName => 'Ragione Sociale'; + + @override + String get createCompanyScreenVatId => 'Partita IVA'; + + @override + String get createCompanyScreenFiscalCode => 'Codice Fiscale'; + + @override + String get createCompanyScreenSdiPec => 'Codice Univoco (SDI) / PEC'; + + @override + String get createCompanyScreenCompanyLegalAddress => 'SEDE LEGALE'; + + @override + String get commonAddress => 'Indirizzo e n. civico'; + + @override + String get commonCity => 'Città'; + + @override + String get commonZipCode => 'CAP'; + + @override + String get commonProvince => 'Prov'; + + @override + String get commonCountry => 'Paese'; + + @override + String get createCompanyScreenUploadLogo => 'Carica Logo Aziendale'; + + @override + String get createCompanyScreenWillBeUsedForReceipts => + 'Verrà utilizzato per le tue stampe e ricevute'; + + @override + String get createCompanyScreenSaveCompany => 'SALVA AZIENDA'; + + @override + String get createCompanyScreenSetupYourCompany => 'Configura la tua Azienda'; + + @override + String get createCompanyScreenFluxNeedsYourFiscalData => + 'FLUX ha bisogno dei tuoi dati fiscali per gestire correttamente le fatturazioni e le attivazioni dei tuoi negozi.'; } diff --git a/lib/main.dart b/lib/main.dart index 3e64a34..d8b2451 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -155,9 +155,7 @@ class _FluxAppState extends State { routerConfig: _router, localizationsDelegates: AppLocalizations.localizationsDelegates, supportedLocales: AppLocalizations.supportedLocales, - locale: const Locale( - 'it', - ), // Per ora forziamo l'italiano, poi lo renderemo dinamico! + locale: const Locale('it'), ); }, ); diff --git a/pubspec.yaml b/pubspec.yaml index 1bef9ab..f511d7a 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -28,8 +28,6 @@ dependencies: qr_flutter: ^4.1.0 shared_preferences: ^2.5.5 supabase_flutter: ^2.12.2 - - dev_dependencies: flutter_test: @@ -43,4 +41,4 @@ flutter: assets: - assets/images/ - assets/svg/ - - .env \ No newline at end of file + - .env