refactoring
This commit is contained in:
@@ -65,7 +65,7 @@ class _SystemSettingsPageState extends State<SystemSettingsPage>
|
||||
// Accès réservé aux super administrateurs (configuration système globale)
|
||||
if (authState is! AuthAuthenticated || authState.effectiveRole != UserRole.superAdmin) {
|
||||
return Scaffold(
|
||||
backgroundColor: const Color(0xFFF8F9FA),
|
||||
backgroundColor: AppColors.lightBackground,
|
||||
appBar: AppBar(
|
||||
title: const Text('Paramètres Système'),
|
||||
leading: IconButton(
|
||||
@@ -80,14 +80,14 @@ class _SystemSettingsPageState extends State<SystemSettingsPage>
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Icon(Icons.lock_outline, size: 64, color: ColorTokens.onSurfaceVariant.withOpacity(0.5)),
|
||||
Icon(Icons.lock_outline, size: 64, color: AppColors.textSecondaryLight.withOpacity(0.5)),
|
||||
const SizedBox(height: 16),
|
||||
Text(
|
||||
'Accès réservé',
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: ColorTokens.onSurface,
|
||||
color: AppColors.textPrimaryLight,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
@@ -96,7 +96,7 @@ class _SystemSettingsPageState extends State<SystemSettingsPage>
|
||||
'Les paramètres système sont réservés aux administrateurs plateforme.',
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: ColorTokens.onSurfaceVariant,
|
||||
color: AppColors.textSecondaryLight,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
@@ -121,7 +121,7 @@ class _SystemSettingsPageState extends State<SystemSettingsPage>
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(state.message),
|
||||
backgroundColor: ColorTokens.success,
|
||||
backgroundColor: AppColors.success,
|
||||
behavior: SnackBarBehavior.floating,
|
||||
),
|
||||
);
|
||||
@@ -129,7 +129,7 @@ class _SystemSettingsPageState extends State<SystemSettingsPage>
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(state.error),
|
||||
backgroundColor: ColorTokens.error,
|
||||
backgroundColor: AppColors.error,
|
||||
behavior: SnackBarBehavior.floating,
|
||||
),
|
||||
);
|
||||
@@ -137,7 +137,7 @@ class _SystemSettingsPageState extends State<SystemSettingsPage>
|
||||
},
|
||||
builder: (context, state) {
|
||||
return Scaffold(
|
||||
backgroundColor: const Color(0xFFF8F9FA),
|
||||
backgroundColor: AppColors.lightBackground,
|
||||
body: Column(
|
||||
children: [
|
||||
// Header harmonisé
|
||||
@@ -172,18 +172,18 @@ class _SystemSettingsPageState extends State<SystemSettingsPage>
|
||||
/// Header harmonisé avec indicateurs système
|
||||
Widget _buildHeader() {
|
||||
return Container(
|
||||
margin: const EdgeInsets.all(SpacingTokens.lg),
|
||||
padding: const EdgeInsets.all(SpacingTokens.xxl),
|
||||
margin: const EdgeInsets.symmetric(horizontal: SpacingTokens.sm, vertical: SpacingTokens.xs),
|
||||
padding: const EdgeInsets.all(SpacingTokens.md),
|
||||
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),
|
||||
),
|
||||
@@ -194,18 +194,18 @@ class _SystemSettingsPageState extends State<SystemSettingsPage>
|
||||
Row(
|
||||
children: [
|
||||
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.settings,
|
||||
color: Colors.white,
|
||||
size: 24,
|
||||
size: 20,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
@@ -263,8 +263,8 @@ class _SystemSettingsPageState extends State<SystemSettingsPage>
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
|
||||
const SizedBox(height: 8),
|
||||
|
||||
// Indicateurs système
|
||||
Row(
|
||||
children: [
|
||||
@@ -354,9 +354,9 @@ class _SystemSettingsPageState extends State<SystemSettingsPage>
|
||||
),
|
||||
child: TabBar(
|
||||
controller: _tabController,
|
||||
labelColor: ColorTokens.primary,
|
||||
unselectedLabelColor: ColorTokens.onSurfaceVariant,
|
||||
indicatorColor: ColorTokens.primary,
|
||||
labelColor: AppColors.primaryGreen,
|
||||
unselectedLabelColor: AppColors.textSecondaryLight,
|
||||
indicatorColor: AppColors.primaryGreen,
|
||||
indicatorWeight: 3,
|
||||
indicatorSize: TabBarIndicatorSize.tab,
|
||||
labelStyle: const TextStyle(
|
||||
@@ -399,7 +399,7 @@ class _SystemSettingsPageState extends State<SystemSettingsPage>
|
||||
padding: const EdgeInsets.all(12),
|
||||
child: Column(
|
||||
children: [
|
||||
const SizedBox(height: 16),
|
||||
const SizedBox(height: 8),
|
||||
|
||||
// Configuration de base
|
||||
_buildSettingsSection(
|
||||
@@ -457,14 +457,14 @@ class _SystemSettingsPageState extends State<SystemSettingsPage>
|
||||
? 'Supprimer tous les fichiers temporaires (${_metrics!.totalCacheSizeFormatted ?? "0 B"})'
|
||||
: 'Supprimer tous les fichiers temporaires',
|
||||
Icons.delete_sweep,
|
||||
const Color(0xFFE17055),
|
||||
AppColors.warning,
|
||||
() => _clearSystemCache(),
|
||||
),
|
||||
_buildActionSetting(
|
||||
'Optimiser la base de données',
|
||||
'Réorganiser et compacter la base de données',
|
||||
Icons.tune,
|
||||
const Color(0xFF0984E3),
|
||||
AppColors.primaryGreen,
|
||||
() => _optimizeDatabase(),
|
||||
),
|
||||
],
|
||||
@@ -485,7 +485,7 @@ class _SystemSettingsPageState extends State<SystemSettingsPage>
|
||||
'Tester la connectivité',
|
||||
'Vérifier la connexion aux services',
|
||||
Icons.network_ping,
|
||||
const Color(0xFF00B894),
|
||||
AppColors.success,
|
||||
() => _testConnectivity(),
|
||||
),
|
||||
],
|
||||
@@ -533,7 +533,7 @@ class _SystemSettingsPageState extends State<SystemSettingsPage>
|
||||
'Régénérer les clés API',
|
||||
'Créer de nouvelles clés d\'authentification',
|
||||
Icons.vpn_key,
|
||||
const Color(0xFFE17055),
|
||||
AppColors.warning,
|
||||
() => _regenerateApiKeys(),
|
||||
),
|
||||
],
|
||||
@@ -566,7 +566,7 @@ class _SystemSettingsPageState extends State<SystemSettingsPage>
|
||||
'Réinitialiser les sessions',
|
||||
'Nettoyer les sessions expirées',
|
||||
Icons.refresh,
|
||||
const Color(0xFF0984E3),
|
||||
AppColors.primaryGreen,
|
||||
() => _resetSessions(),
|
||||
),
|
||||
],
|
||||
@@ -584,21 +584,21 @@ class _SystemSettingsPageState extends State<SystemSettingsPage>
|
||||
'Générer rapport d\'audit',
|
||||
'Créer un rapport complet des activités',
|
||||
Icons.assessment,
|
||||
ColorTokens.primary,
|
||||
AppColors.primaryGreen,
|
||||
() => _generateAuditReport(),
|
||||
),
|
||||
_buildActionSetting(
|
||||
'Export RGPD',
|
||||
'Exporter toutes les données utilisateurs',
|
||||
Icons.download,
|
||||
const Color(0xFF00B894),
|
||||
AppColors.success,
|
||||
() => _exportGDPRData(),
|
||||
),
|
||||
_buildActionSetting(
|
||||
'Purge des données',
|
||||
'Supprimer les données expirées (RGPD)',
|
||||
Icons.auto_delete,
|
||||
const Color(0xFFE17055),
|
||||
AppColors.warning,
|
||||
() => _purgeExpiredData(),
|
||||
),
|
||||
],
|
||||
@@ -701,14 +701,14 @@ class _SystemSettingsPageState extends State<SystemSettingsPage>
|
||||
'Analyser les performances',
|
||||
'Scanner les goulots d\'étranglement',
|
||||
Icons.analytics,
|
||||
const Color(0xFF0984E3),
|
||||
AppColors.primaryGreen,
|
||||
() => _analyzePerformance(),
|
||||
),
|
||||
_buildActionSetting(
|
||||
'Nettoyer les logs anciens',
|
||||
'Supprimer les logs de plus de 30 jours',
|
||||
Icons.cleaning_services,
|
||||
const Color(0xFFE17055),
|
||||
AppColors.warning,
|
||||
() => _cleanOldLogs(),
|
||||
),
|
||||
_buildActionSetting(
|
||||
@@ -761,14 +761,14 @@ class _SystemSettingsPageState extends State<SystemSettingsPage>
|
||||
'Créer une sauvegarde maintenant',
|
||||
'Sauvegarder immédiatement toutes les données',
|
||||
Icons.save,
|
||||
const Color(0xFF00B894),
|
||||
AppColors.success,
|
||||
() => _createBackup(),
|
||||
),
|
||||
_buildActionSetting(
|
||||
'Restaurer depuis une sauvegarde',
|
||||
'Récupérer des données depuis un fichier',
|
||||
Icons.restore,
|
||||
const Color(0xFF0984E3),
|
||||
AppColors.primaryGreen,
|
||||
() => _restoreFromBackup(),
|
||||
),
|
||||
],
|
||||
@@ -794,7 +794,7 @@ class _SystemSettingsPageState extends State<SystemSettingsPage>
|
||||
'Planifier une maintenance',
|
||||
'Programmer une fenêtre de maintenance',
|
||||
Icons.schedule,
|
||||
ColorTokens.primary,
|
||||
AppColors.primaryGreen,
|
||||
() => _scheduleMaintenance(),
|
||||
),
|
||||
_buildActionSetting(
|
||||
@@ -827,14 +827,14 @@ class _SystemSettingsPageState extends State<SystemSettingsPage>
|
||||
'Vérifier les mises à jour',
|
||||
'Rechercher les nouvelles versions',
|
||||
Icons.refresh,
|
||||
const Color(0xFF0984E3),
|
||||
AppColors.primaryGreen,
|
||||
() => _checkUpdates(),
|
||||
),
|
||||
_buildActionSetting(
|
||||
'Historique des mises à jour',
|
||||
'Voir les versions précédentes',
|
||||
Icons.history,
|
||||
ColorTokens.primary,
|
||||
AppColors.primaryGreen,
|
||||
() => _showUpdateHistory(),
|
||||
),
|
||||
],
|
||||
@@ -864,13 +864,13 @@ class _SystemSettingsPageState extends State<SystemSettingsPage>
|
||||
'CPU élevé',
|
||||
'Alerte si CPU > 80% pendant 5 min',
|
||||
true,
|
||||
const Color(0xFFE17055),
|
||||
AppColors.warning,
|
||||
),
|
||||
_buildAlertItem(
|
||||
'Mémoire faible',
|
||||
'Alerte si RAM < 20% disponible',
|
||||
true,
|
||||
const Color(0xFFE17055),
|
||||
AppColors.warning,
|
||||
),
|
||||
_buildAlertItem(
|
||||
'Disque plein',
|
||||
@@ -882,7 +882,7 @@ class _SystemSettingsPageState extends State<SystemSettingsPage>
|
||||
'Connexions échouées',
|
||||
'Alerte si > 100 échecs/min',
|
||||
false,
|
||||
const Color(0xFF0984E3),
|
||||
AppColors.primaryGreen,
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -919,14 +919,14 @@ class _SystemSettingsPageState extends State<SystemSettingsPage>
|
||||
'Voir tous les logs',
|
||||
'Ouvrir la console de logs complète',
|
||||
Icons.terminal,
|
||||
ColorTokens.primary,
|
||||
AppColors.primaryGreen,
|
||||
() => _viewAllLogs(),
|
||||
),
|
||||
_buildActionSetting(
|
||||
'Exporter les logs',
|
||||
'Télécharger les logs pour analyse',
|
||||
Icons.download,
|
||||
const Color(0xFF00B894),
|
||||
AppColors.success,
|
||||
() => _exportLogs(),
|
||||
),
|
||||
],
|
||||
@@ -960,7 +960,7 @@ class _SystemSettingsPageState extends State<SystemSettingsPage>
|
||||
'Rapport détaillé',
|
||||
'Générer un rapport complet d\'utilisation',
|
||||
Icons.assessment,
|
||||
ColorTokens.primary,
|
||||
AppColors.primaryGreen,
|
||||
() => _generateUsageReport(),
|
||||
),
|
||||
],
|
||||
@@ -1053,9 +1053,9 @@ class _SystemSettingsPageState extends State<SystemSettingsPage>
|
||||
child: Row(
|
||||
children: [
|
||||
if (isWarning)
|
||||
const Icon(Icons.warning, color: ColorTokens.warning, size: 20)
|
||||
const Icon(Icons.warning, color: AppColors.warning, size: 20)
|
||||
else
|
||||
const Icon(Icons.toggle_on, color: ColorTokens.primary, size: 20),
|
||||
const Icon(Icons.toggle_on, color: AppColors.primaryGreen, size: 20),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: Column(
|
||||
@@ -1066,7 +1066,7 @@ class _SystemSettingsPageState extends State<SystemSettingsPage>
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: isWarning ? Colors.orange[800] : const Color(0xFF1F2937),
|
||||
color: isWarning ? AppColors.warning : AppColors.textPrimaryLight,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
@@ -1082,7 +1082,7 @@ class _SystemSettingsPageState extends State<SystemSettingsPage>
|
||||
Switch(
|
||||
value: value,
|
||||
onChanged: onChanged,
|
||||
activeColor: isWarning ? ColorTokens.warning : ColorTokens.primary,
|
||||
activeColor: isWarning ? AppColors.warning : AppColors.primaryGreen,
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -1108,7 +1108,7 @@ class _SystemSettingsPageState extends State<SystemSettingsPage>
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
const Icon(Icons.arrow_drop_down, color: ColorTokens.primary, size: 20),
|
||||
const Icon(Icons.arrow_drop_down, color: AppColors.primaryGreen, size: 20),
|
||||
const SizedBox(width: SpacingTokens.lg),
|
||||
Expanded(
|
||||
child: Column(
|
||||
@@ -1119,7 +1119,7 @@ class _SystemSettingsPageState extends State<SystemSettingsPage>
|
||||
style: const TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Color(0xFF1F2937),
|
||||
color: AppColors.textPrimaryLight,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
@@ -1230,7 +1230,7 @@ class _SystemSettingsPageState extends State<SystemSettingsPage>
|
||||
style: const TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Color(0xFF1F2937),
|
||||
color: AppColors.textPrimaryLight,
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -1266,7 +1266,7 @@ class _SystemSettingsPageState extends State<SystemSettingsPage>
|
||||
style: const TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Color(0xFF1F2937),
|
||||
color: AppColors.textPrimaryLight,
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -1360,7 +1360,7 @@ class _SystemSettingsPageState extends State<SystemSettingsPage>
|
||||
style: const TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Color(0xFF1F2937),
|
||||
color: AppColors.textPrimaryLight,
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -1394,7 +1394,7 @@ class _SystemSettingsPageState extends State<SystemSettingsPage>
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
const Icon(Icons.bar_chart, color: ColorTokens.primary, size: 20),
|
||||
const Icon(Icons.bar_chart, color: AppColors.primaryGreen, size: 20),
|
||||
const SizedBox(width: SpacingTokens.lg),
|
||||
Expanded(
|
||||
child: Text(
|
||||
@@ -1402,7 +1402,7 @@ class _SystemSettingsPageState extends State<SystemSettingsPage>
|
||||
style: const TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Color(0xFF1F2937),
|
||||
color: AppColors.textPrimaryLight,
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -1455,8 +1455,8 @@ class _SystemSettingsPageState extends State<SystemSettingsPage>
|
||||
_showSuccessSnackBar('État du système actualisé');
|
||||
},
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: ColorTokens.primary,
|
||||
foregroundColor: ColorTokens.onPrimary,
|
||||
backgroundColor: AppColors.primaryGreen,
|
||||
foregroundColor: Colors.white,
|
||||
),
|
||||
child: const Text('Actualiser'),
|
||||
),
|
||||
@@ -1507,8 +1507,8 @@ class _SystemSettingsPageState extends State<SystemSettingsPage>
|
||||
_showSuccessSnackBar('Configuration exportée avec succès');
|
||||
},
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: ColorTokens.primary,
|
||||
foregroundColor: ColorTokens.onPrimary,
|
||||
backgroundColor: AppColors.primaryGreen,
|
||||
foregroundColor: Colors.white,
|
||||
),
|
||||
child: const Text('Exporter'),
|
||||
),
|
||||
@@ -1625,7 +1625,7 @@ class _SystemSettingsPageState extends State<SystemSettingsPage>
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(message),
|
||||
backgroundColor: const Color(0xFF00B894),
|
||||
backgroundColor: AppColors.success,
|
||||
behavior: SnackBarBehavior.floating,
|
||||
),
|
||||
);
|
||||
@@ -1636,7 +1636,7 @@ class _SystemSettingsPageState extends State<SystemSettingsPage>
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(message),
|
||||
backgroundColor: const Color(0xFFE74C3C),
|
||||
backgroundColor: AppColors.error,
|
||||
behavior: SnackBarBehavior.floating,
|
||||
),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user