Maxiwere45 a2a7ffd79f feat(i18n): add FR/EN internationalization with in-app language selector
- gen-l10n setup (flutter_localizations, intl, l10n.yaml, ARB en/fr)
- localeProvider (persisted) wired into MaterialApp
- language selector in the System page (alongside the color palette)
- all user-facing strings across screens moved to AppLocalizations

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-23 12:13:51 +02:00

61 lines
2.1 KiB
Dart

import 'package:flutter/material.dart';
import '../../providers/locale_provider.dart';
/// Sélecteur de langue de l'application (parmi [supportedLocales]).
class LanguagePicker extends StatelessWidget {
final Locale selected;
final Color primaryColor;
final void Function(Locale) onSelect;
const LanguagePicker({
super.key,
required this.selected,
required this.primaryColor,
required this.onSelect,
});
static const _names = {'en': 'English', 'fr': 'Français'};
static const _flags = {'en': '🇬🇧', 'fr': '🇫🇷'};
@override
Widget build(BuildContext context) {
return Column(
children: supportedLocales.map((locale) {
final isSelected = locale.languageCode == selected.languageCode;
return GestureDetector(
onTap: () => onSelect(locale),
child: AnimatedContainer(
duration: const Duration(milliseconds: 200),
margin: const EdgeInsets.only(bottom: 10),
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 14),
decoration: BoxDecoration(
color: isSelected ? primaryColor : Colors.white,
borderRadius: BorderRadius.circular(12),
border: Border.all(
color: isSelected ? primaryColor : Colors.grey.shade300,
width: isSelected ? 3 : 1.5,
),
),
child: Row(
children: [
Text(_flags[locale.languageCode] ?? '', style: const TextStyle(fontSize: 22)),
const SizedBox(width: 16),
Text(
_names[locale.languageCode] ?? locale.languageCode,
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
color: isSelected ? Colors.white : Colors.black87,
),
),
const Spacer(),
if (isSelected) const Icon(Icons.check_circle, color: Colors.white, size: 22),
],
),
),
);
}).toList(),
);
}
}