refactoring
This commit is contained in:
@@ -43,7 +43,7 @@ class _LanguageSettingsPageState extends State<LanguageSettingsPage> {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text('Langue changée en $languageName'),
|
||||
backgroundColor: const Color(0xFF00B894),
|
||||
backgroundColor: AppColors.success,
|
||||
behavior: SnackBarBehavior.floating,
|
||||
),
|
||||
);
|
||||
@@ -53,7 +53,7 @@ class _LanguageSettingsPageState extends State<LanguageSettingsPage> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: const Color(0xFFF8F9FA),
|
||||
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
|
||||
body: Column(
|
||||
children: [
|
||||
_buildHeader(),
|
||||
@@ -62,9 +62,9 @@ class _LanguageSettingsPageState extends State<LanguageSettingsPage> {
|
||||
padding: const EdgeInsets.all(12),
|
||||
child: Column(
|
||||
children: [
|
||||
const SizedBox(height: 16),
|
||||
const SizedBox(height: 8),
|
||||
_buildLanguageList(),
|
||||
const SizedBox(height: 16),
|
||||
const SizedBox(height: 8),
|
||||
_buildInfoSection(),
|
||||
const SizedBox(height: 80),
|
||||
],
|
||||
@@ -82,14 +82,14 @@ class _LanguageSettingsPageState extends State<LanguageSettingsPage> {
|
||||
padding: const EdgeInsets.all(SpacingTokens.xxl),
|
||||
decoration: BoxDecoration(
|
||||
gradient: const LinearGradient(
|
||||
colors: ColorTokens.primaryGradient,
|
||||
colors: [AppColors.brandGreen, AppColors.primaryGreen],
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(SpacingTokens.xl),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: ColorTokens.primary.withOpacity(0.3),
|
||||
color: AppColors.primaryGreen.withOpacity(0.3),
|
||||
blurRadius: 20,
|
||||
offset: const Offset(0, 8),
|
||||
),
|
||||
@@ -104,12 +104,12 @@ class _LanguageSettingsPageState extends State<LanguageSettingsPage> {
|
||||
icon: const Icon(Icons.arrow_back, color: Colors.white),
|
||||
),
|
||||
Container(
|
||||
padding: const EdgeInsets.all(12),
|
||||
padding: const EdgeInsets.all(8),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white.withOpacity(0.2),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: const Icon(Icons.language, color: Colors.white, size: 24),
|
||||
child: const Icon(Icons.language, color: Colors.white, size: 20),
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
Expanded(
|
||||
@@ -141,37 +141,29 @@ class _LanguageSettingsPageState extends State<LanguageSettingsPage> {
|
||||
}
|
||||
|
||||
Widget _buildLanguageList() {
|
||||
final isDark = Theme.of(context).brightness == Brightness.dark;
|
||||
final textPrimary = isDark ? AppColors.textPrimaryDark : AppColors.textPrimaryLight;
|
||||
final textSecondary = isDark ? AppColors.textSecondaryDark : AppColors.textSecondaryLight;
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
padding: const EdgeInsets.all(10),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withOpacity(0.05),
|
||||
blurRadius: 10,
|
||||
offset: const Offset(0, 2),
|
||||
),
|
||||
],
|
||||
color: isDark ? AppColors.darkSurface : Colors.white,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Icon(Icons.translate, color: Colors.grey[600], size: 20),
|
||||
Icon(Icons.translate, color: textSecondary, size: 20),
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
'Langues disponibles',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Colors.grey[800],
|
||||
),
|
||||
style: AppTypography.headerSmall.copyWith(fontWeight: FontWeight.w600, color: textPrimary),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
const SizedBox(height: 8),
|
||||
..._supportedLanguages.map((lang) => _buildLanguageTile(lang)),
|
||||
],
|
||||
),
|
||||
@@ -179,22 +171,25 @@ class _LanguageSettingsPageState extends State<LanguageSettingsPage> {
|
||||
}
|
||||
|
||||
Widget _buildLanguageTile(_LanguageOption lang) {
|
||||
final isDark = Theme.of(context).brightness == Brightness.dark;
|
||||
final isSelected = _selectedLanguage == lang.name;
|
||||
final textPrimary = isDark ? AppColors.textPrimaryDark : AppColors.textPrimaryLight;
|
||||
final textSecondary = isDark ? AppColors.textSecondaryDark : AppColors.textSecondaryLight;
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(bottom: 8),
|
||||
padding: const EdgeInsets.only(bottom: 6),
|
||||
child: InkWell(
|
||||
onTap: () => _changeLanguage(lang.name, lang.code),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(14),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 7),
|
||||
decoration: BoxDecoration(
|
||||
color: isSelected
|
||||
? ColorTokens.primary.withOpacity(0.08)
|
||||
: Colors.grey[50],
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
? AppColors.primaryGreen.withOpacity(0.08)
|
||||
: (isDark ? AppColors.darkBackground : Colors.grey[50]),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: isSelected
|
||||
? Border.all(color: ColorTokens.primary.withOpacity(0.4), width: 1.5)
|
||||
: Border.all(color: Colors.grey[200]!),
|
||||
? Border.all(color: AppColors.primaryGreen.withOpacity(0.4), width: 1.5)
|
||||
: Border.all(color: isDark ? AppColors.darkBorder : Colors.grey[200]!),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
@@ -206,21 +201,20 @@ class _LanguageSettingsPageState extends State<LanguageSettingsPage> {
|
||||
children: [
|
||||
Text(
|
||||
lang.name,
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
style: AppTypography.bodyTextSmall.copyWith(
|
||||
fontWeight: FontWeight.w600,
|
||||
color: isSelected ? ColorTokens.primary : const Color(0xFF1F2937),
|
||||
color: isSelected ? AppColors.primaryGreen : textPrimary,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
lang.description,
|
||||
style: TextStyle(fontSize: 12, color: Colors.grey[600]),
|
||||
style: AppTypography.subtitleSmall.copyWith(color: textSecondary),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
if (isSelected)
|
||||
const Icon(Icons.check_circle, color: ColorTokens.primary, size: 22),
|
||||
const Icon(Icons.check_circle, color: AppColors.primaryGreen, size: 22),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -229,41 +223,33 @@ class _LanguageSettingsPageState extends State<LanguageSettingsPage> {
|
||||
}
|
||||
|
||||
Widget _buildInfoSection() {
|
||||
final isDark = Theme.of(context).brightness == Brightness.dark;
|
||||
final textPrimary = isDark ? AppColors.textPrimaryDark : AppColors.textPrimaryLight;
|
||||
final textSecondary = isDark ? AppColors.textSecondaryDark : AppColors.textSecondaryLight;
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
padding: const EdgeInsets.all(10),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withOpacity(0.05),
|
||||
blurRadius: 10,
|
||||
offset: const Offset(0, 2),
|
||||
),
|
||||
],
|
||||
color: isDark ? AppColors.darkSurface : Colors.white,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Icon(Icons.info_outline, color: Colors.grey[600], size: 20),
|
||||
Icon(Icons.info_outline, color: textSecondary, size: 20),
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
'Information',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Colors.grey[800],
|
||||
),
|
||||
style: AppTypography.headerSmall.copyWith(fontWeight: FontWeight.w600, color: textPrimary),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
'Le changement de langue s\'applique immédiatement à toute l\'interface. '
|
||||
'Les contenus générés par le serveur restent dans leur langue d\'origine.',
|
||||
style: TextStyle(fontSize: 13, color: Colors.grey[600], height: 1.5),
|
||||
style: AppTypography.subtitleSmall.copyWith(color: textSecondary, height: 1.5),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user