feat: Mise à jour des interfaces mobiles v3.2.3
- Amélioration des interfaces utilisateur sur mobile - Optimisation de la responsivité des composants Flutter - Mise à jour des widgets de chat et communication - Amélioration des formulaires et tableaux - Ajout de nouveaux composants pour l'administration - Optimisation des thèmes et styles visuels 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
import 'dart:convert';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:geosector_app/core/theme/app_theme.dart';
|
||||
import 'package:geosector_app/app.dart';
|
||||
import 'package:geosector_app/core/services/app_info_service.dart';
|
||||
import 'package:geosector_app/core/services/current_amicale_service.dart';
|
||||
import 'package:geosector_app/presentation/widgets/connectivity_indicator.dart';
|
||||
import 'package:geosector_app/presentation/widgets/user_form_dialog.dart';
|
||||
import 'package:geosector_app/core/utils/api_exception.dart';
|
||||
import 'package:geosector_app/core/services/theme_service.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
|
||||
/// AppBar personnalisée pour les tableaux de bord
|
||||
@@ -36,8 +36,9 @@ class DashboardAppBar extends StatelessWidget implements PreferredSizeWidget {
|
||||
final theme = Theme.of(context);
|
||||
// Vérifier si le logo de l'amicale est présent pour ajuster la largeur du leading
|
||||
final amicale = CurrentAmicaleService.instance.currentAmicale;
|
||||
final hasAmicaleLogo = amicale?.logoBase64 != null && amicale!.logoBase64!.isNotEmpty;
|
||||
|
||||
final hasAmicaleLogo =
|
||||
amicale?.logoBase64 != null && amicale!.logoBase64!.isNotEmpty;
|
||||
|
||||
return Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
@@ -48,7 +49,9 @@ class DashboardAppBar extends StatelessWidget implements PreferredSizeWidget {
|
||||
elevation: 4,
|
||||
leading: _buildLogo(),
|
||||
// Ajuster la largeur du leading si le logo de l'amicale est présent
|
||||
leadingWidth: hasAmicaleLogo ? 110 : 56, // 56 par défaut, 110 pour 2 logos + espacement
|
||||
leadingWidth: hasAmicaleLogo
|
||||
? 110
|
||||
: 56, // 56 par défaut, 110 pour 2 logos + espacement
|
||||
actions: _buildActions(context),
|
||||
),
|
||||
// Bordure colorée selon le rôle
|
||||
@@ -64,7 +67,7 @@ class DashboardAppBar extends StatelessWidget implements PreferredSizeWidget {
|
||||
Widget _buildLogo() {
|
||||
final amicale = CurrentAmicaleService.instance.currentAmicale;
|
||||
final logoBase64 = amicale?.logoBase64;
|
||||
|
||||
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Row(
|
||||
@@ -93,9 +96,9 @@ class DashboardAppBar extends StatelessWidget implements PreferredSizeWidget {
|
||||
if (logoBase64.contains('base64,')) {
|
||||
base64String = logoBase64.split('base64,').last;
|
||||
}
|
||||
|
||||
|
||||
final decodedBytes = base64Decode(base64String);
|
||||
|
||||
|
||||
return Container(
|
||||
width: 40,
|
||||
height: 40,
|
||||
@@ -147,8 +150,8 @@ class DashboardAppBar extends StatelessWidget implements PreferredSizeWidget {
|
||||
actions.add(
|
||||
Text(
|
||||
"v${AppInfoService.version}",
|
||||
style: const TextStyle(
|
||||
fontSize: 12,
|
||||
style: TextStyle(
|
||||
fontSize: AppTheme.r(context, 12),
|
||||
color: Colors.white70,
|
||||
),
|
||||
),
|
||||
@@ -192,7 +195,9 @@ class DashboardAppBar extends StatelessWidget implements PreferredSizeWidget {
|
||||
}
|
||||
} catch (e) {
|
||||
debugPrint('❌ Erreur mise à jour de votre profil: $e');
|
||||
ApiException.showError(context, e);
|
||||
if (context.mounted) {
|
||||
ApiException.showError(context, e);
|
||||
}
|
||||
}
|
||||
},
|
||||
),
|
||||
@@ -247,8 +252,10 @@ class DashboardAppBar extends StatelessWidget implements PreferredSizeWidget {
|
||||
const Duration(milliseconds: 100));
|
||||
|
||||
// Navigation vers splash avec paramètres pour redirection automatique
|
||||
final loginType = isAdmin ? 'admin' : 'user';
|
||||
context.go('/?action=login&type=$loginType');
|
||||
if (context.mounted) {
|
||||
final loginType = isAdmin ? 'admin' : 'user';
|
||||
context.go('/?action=login&type=$loginType');
|
||||
}
|
||||
}
|
||||
},
|
||||
child: const Text('Déconnexion'),
|
||||
@@ -277,14 +284,15 @@ class DashboardAppBar extends StatelessWidget implements PreferredSizeWidget {
|
||||
builder: (context, constraints) {
|
||||
// Déterminer si on est sur mobile ou écran étroit
|
||||
final isNarrowScreen = constraints.maxWidth < 600;
|
||||
final isMobilePlatform = Theme.of(context).platform == TargetPlatform.android ||
|
||||
Theme.of(context).platform == TargetPlatform.iOS;
|
||||
|
||||
final isMobilePlatform =
|
||||
Theme.of(context).platform == TargetPlatform.android ||
|
||||
Theme.of(context).platform == TargetPlatform.iOS;
|
||||
|
||||
// Sur mobile ou écrans étroits, afficher seulement le titre principal
|
||||
if (isNarrowScreen || isMobilePlatform) {
|
||||
return Text(title);
|
||||
}
|
||||
|
||||
|
||||
// Sur écrans larges (web desktop), afficher le titre de la page ou le titre principal
|
||||
// Pour les admins, on affiche directement le titre de la page sans préfixe
|
||||
return Text(pageTitle!);
|
||||
@@ -292,136 +300,6 @@ class DashboardAppBar extends StatelessWidget implements PreferredSizeWidget {
|
||||
);
|
||||
}
|
||||
|
||||
/// Construction du sélecteur de thème avec confirmation
|
||||
Widget _buildThemeSwitcherWithConfirmation(BuildContext context) {
|
||||
return IconButton(
|
||||
icon: Icon(ThemeService.instance.themeModeIcon),
|
||||
tooltip:
|
||||
'Changer le thème (${ThemeService.instance.themeModeDescription})',
|
||||
onPressed: () async {
|
||||
final themeService = ThemeService.instance;
|
||||
final currentTheme = themeService.themeModeDescription;
|
||||
|
||||
// Déterminer le prochain thème
|
||||
String nextTheme;
|
||||
switch (themeService.themeMode) {
|
||||
case ThemeMode.light:
|
||||
nextTheme = 'Sombre';
|
||||
break;
|
||||
case ThemeMode.dark:
|
||||
nextTheme = 'Clair';
|
||||
break;
|
||||
case ThemeMode.system:
|
||||
nextTheme = themeService.isSystemDark ? 'Clair' : 'Sombre';
|
||||
break;
|
||||
}
|
||||
|
||||
// Afficher la confirmation
|
||||
final confirmed = await showDialog<bool>(
|
||||
context: context,
|
||||
builder: (dialogContext) => AlertDialog(
|
||||
title: const Row(
|
||||
children: [
|
||||
Icon(Icons.palette_outlined),
|
||||
SizedBox(width: 8),
|
||||
Text('Changement de thème'),
|
||||
],
|
||||
),
|
||||
content: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const Text('Vous êtes actuellement sur le thème :'),
|
||||
const SizedBox(height: 8),
|
||||
Container(
|
||||
padding: const EdgeInsets.all(12),
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.primaryContainer
|
||||
.withOpacity(0.3),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: Border.all(
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.primary
|
||||
.withOpacity(0.3),
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(
|
||||
themeService.themeModeIcon,
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
currentTheme,
|
||||
style: const TextStyle(fontWeight: FontWeight.bold),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
Text('Voulez-vous passer au thème $nextTheme ?'),
|
||||
const SizedBox(height: 8),
|
||||
Container(
|
||||
padding: const EdgeInsets.all(8),
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.errorContainer
|
||||
.withOpacity(0.3),
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
),
|
||||
child: const Row(
|
||||
children: [
|
||||
Icon(Icons.warning_amber, size: 16),
|
||||
SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: Text(
|
||||
'Note: Vous devrez vous reconnecter après ce changement.',
|
||||
style: TextStyle(fontSize: 12),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(dialogContext).pop(false),
|
||||
child: const Text('Annuler'),
|
||||
),
|
||||
ElevatedButton(
|
||||
onPressed: () => Navigator.of(dialogContext).pop(true),
|
||||
child: Text('Passer au thème $nextTheme'),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
// Si confirmé, changer le thème
|
||||
if (confirmed == true) {
|
||||
await themeService.toggleTheme();
|
||||
|
||||
// Déconnecter l'utilisateur
|
||||
if (context.mounted) {
|
||||
final success = await userRepository.logout(context);
|
||||
if (success && context.mounted) {
|
||||
await Future.delayed(const Duration(milliseconds: 100));
|
||||
// Rediriger vers splash avec paramètres pour revenir au même type de login
|
||||
final loginType = isAdmin ? 'admin' : 'user';
|
||||
context.go('/?action=login&type=$loginType');
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Size get preferredSize =>
|
||||
const Size.fromHeight(kToolbarHeight + 3); // +3 pour la bordure
|
||||
|
||||
Reference in New Issue
Block a user