diff --git a/covas_mobile/lib/main.dart b/covas_mobile/lib/main.dart index 9f4634a..11346a0 100644 --- a/covas_mobile/lib/main.dart +++ b/covas_mobile/lib/main.dart @@ -4,6 +4,7 @@ import 'package:provider/provider.dart'; import 'pages/LoginDemo.dart'; import 'locale_provider.dart'; // <-- à adapter selon ton arborescence +import 'package:flutter_gen/gen_l10n/app_localizations.dart'; void main() async { WidgetsFlutterBinding.ensureInitialized(); @@ -20,8 +21,16 @@ void main() async { class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { + final localeProvider = Provider.of( + context); // écoute les changements de langue return MaterialApp( debugShowCheckedModeBanner: false, + locale: localeProvider.locale, // <-- utilise la locale courante + supportedLocales: const [ + Locale('en'), + Locale('fr'), + ], + localizationsDelegates: AppLocalizations.localizationsDelegates, home: LoginDemo(), ); }