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,7 +1,6 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:geosector_app/chat/pages/rooms_page_embedded.dart';
|
||||
import 'package:geosector_app/chat/chat_module.dart';
|
||||
import 'package:geosector_app/core/services/chat_manager.dart';
|
||||
import 'package:geosector_app/core/services/current_user_service.dart';
|
||||
|
||||
@@ -19,7 +18,6 @@ class _ChatCommunicationPageState extends State<ChatCommunicationPage> {
|
||||
|
||||
// Récupération du rôle de l'utilisateur
|
||||
int get _userRole => CurrentUserService.instance.currentUser?.role ?? 1;
|
||||
String get _userName => CurrentUserService.instance.userName ?? 'Utilisateur';
|
||||
|
||||
// Configuration selon le rôle
|
||||
MaterialColor get _themeColor {
|
||||
@@ -31,40 +29,10 @@ class _ChatCommunicationPageState extends State<ChatCommunicationPage> {
|
||||
}
|
||||
}
|
||||
|
||||
Color get _backgroundColor {
|
||||
switch (_userRole) {
|
||||
case 1: return Colors.green.shade50;
|
||||
case 2: return Colors.red.shade50;
|
||||
case 9: return Colors.blue.shade50;
|
||||
default: return Colors.grey.shade50;
|
||||
}
|
||||
}
|
||||
|
||||
String get _pageTitle {
|
||||
switch (_userRole) {
|
||||
case 1: return 'Messages';
|
||||
case 2: return 'Messages Administration';
|
||||
case 9: return 'Centre de Communication GEOSECTOR';
|
||||
default: return 'Messages';
|
||||
}
|
||||
}
|
||||
|
||||
IconData get _roleIcon {
|
||||
switch (_userRole) {
|
||||
case 1: return Icons.person;
|
||||
case 2: return Icons.admin_panel_settings;
|
||||
case 9: return Icons.shield;
|
||||
default: return Icons.chat;
|
||||
}
|
||||
}
|
||||
|
||||
bool get _showStatsButton => _userRole == 9; // Super Admin uniquement
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// Détection de la plateforme
|
||||
final isWeb = kIsWeb;
|
||||
final isMobile = !isWeb;
|
||||
|
||||
// Construction adaptative
|
||||
if (isWeb) {
|
||||
@@ -80,25 +48,7 @@ class _ChatCommunicationPageState extends State<ChatCommunicationPage> {
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.transparent,
|
||||
body: Container(
|
||||
margin: const EdgeInsets.all(16.0),
|
||||
decoration: BoxDecoration(
|
||||
color: theme.colorScheme.surface,
|
||||
borderRadius: BorderRadius.circular(24),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: theme.shadowColor.withOpacity(0.1),
|
||||
blurRadius: 20,
|
||||
spreadRadius: 1,
|
||||
offset: const Offset(0, 4),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(24),
|
||||
child: _buildContent(theme, isWeb: true),
|
||||
),
|
||||
),
|
||||
body: _buildContent(theme, isWeb: true),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -107,13 +57,6 @@ class _ChatCommunicationPageState extends State<ChatCommunicationPage> {
|
||||
final theme = Theme.of(context);
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(_pageTitle),
|
||||
backgroundColor: _themeColor,
|
||||
foregroundColor: Colors.white,
|
||||
elevation: 2,
|
||||
actions: _buildAppBarActions(),
|
||||
),
|
||||
body: _buildContent(theme, isWeb: false),
|
||||
floatingActionButton: FloatingActionButton(
|
||||
onPressed: _handleNewConversation,
|
||||
@@ -138,13 +81,13 @@ class _ChatCommunicationPageState extends State<ChatCommunicationPage> {
|
||||
Icon(
|
||||
Icons.chat_bubble_outline,
|
||||
size: 80,
|
||||
color: _themeColor.withOpacity(0.3),
|
||||
color: _themeColor.withValues(alpha: 0.3),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
Text(
|
||||
'Module de communication non disponible',
|
||||
style: theme.textTheme.titleLarge?.copyWith(
|
||||
color: theme.colorScheme.onSurface.withOpacity(0.5),
|
||||
color: theme.colorScheme.onSurface.withValues(alpha: 0.5),
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
@@ -152,7 +95,7 @@ class _ChatCommunicationPageState extends State<ChatCommunicationPage> {
|
||||
Text(
|
||||
_getUnavailableMessage(),
|
||||
style: theme.textTheme.bodyMedium?.copyWith(
|
||||
color: theme.colorScheme.onSurface.withOpacity(0.4),
|
||||
color: theme.colorScheme.onSurface.withValues(alpha: 0.4),
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
@@ -176,19 +119,12 @@ class _ChatCommunicationPageState extends State<ChatCommunicationPage> {
|
||||
|
||||
// Le chat est initialisé
|
||||
if (isWeb) {
|
||||
// Version Web avec en-tête personnalisé
|
||||
return Column(
|
||||
children: [
|
||||
_buildWebHeader(theme),
|
||||
Expanded(
|
||||
child: RoomsPageEmbedded(
|
||||
key: _roomsPageKey,
|
||||
onRefreshPressed: () {
|
||||
debugPrint('Conversations actualisées');
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
// Version Web sans en-tête
|
||||
return RoomsPageEmbedded(
|
||||
key: _roomsPageKey,
|
||||
onRefreshPressed: () {
|
||||
debugPrint('Conversations actualisées');
|
||||
},
|
||||
);
|
||||
} else {
|
||||
// Version Mobile, contenu direct
|
||||
@@ -201,84 +137,6 @@ class _ChatCommunicationPageState extends State<ChatCommunicationPage> {
|
||||
}
|
||||
}
|
||||
|
||||
/// En-tête personnalisé pour Web
|
||||
Widget _buildWebHeader(ThemeData theme) {
|
||||
return Container(
|
||||
height: 60,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20),
|
||||
decoration: BoxDecoration(
|
||||
color: _backgroundColor,
|
||||
border: Border(
|
||||
bottom: BorderSide(
|
||||
color: theme.dividerColor.withOpacity(0.1),
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(
|
||||
_roleIcon,
|
||||
color: _themeColor.shade600,
|
||||
size: 24,
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
_pageTitle,
|
||||
style: theme.textTheme.titleLarge?.copyWith(
|
||||
fontWeight: FontWeight.w600,
|
||||
color: _themeColor.shade700,
|
||||
),
|
||||
),
|
||||
if (_userRole == 9)
|
||||
Text(
|
||||
'Connecté en tant que $_userName',
|
||||
style: theme.textTheme.bodySmall?.copyWith(
|
||||
color: _themeColor.shade600,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
// Boutons d'action
|
||||
if (_userRole == 9) ...[
|
||||
// Super Admin : Statistiques
|
||||
TextButton.icon(
|
||||
icon: Icon(Icons.analytics, color: _themeColor.shade600),
|
||||
label: Text(
|
||||
'Statistiques',
|
||||
style: TextStyle(color: _themeColor.shade600),
|
||||
),
|
||||
onPressed: _handleShowStats,
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// Actions pour l'AppBar mobile
|
||||
List<Widget> _buildAppBarActions() {
|
||||
final actions = <Widget>[];
|
||||
|
||||
if (_showStatsButton) {
|
||||
actions.add(
|
||||
IconButton(
|
||||
icon: const Icon(Icons.analytics),
|
||||
onPressed: _handleShowStats,
|
||||
tooltip: 'Statistiques',
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
return actions;
|
||||
}
|
||||
|
||||
/// Message personnalisé selon le rôle quand le chat n'est pas disponible
|
||||
String _getUnavailableMessage() {
|
||||
switch (_userRole) {
|
||||
@@ -298,17 +156,6 @@ class _ChatCommunicationPageState extends State<ChatCommunicationPage> {
|
||||
_roomsPageKey.currentState?.createNewConversation();
|
||||
}
|
||||
|
||||
void _handleShowStats() {
|
||||
// TODO: Implémenter l'affichage des statistiques pour Super Admin
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: const Text('Statistiques à venir...'),
|
||||
backgroundColor: _themeColor,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
void _handleRetryInit() async {
|
||||
// Réessayer l'initialisation du chat (pour Super Admin)
|
||||
await ChatManager.instance.reinitialize();
|
||||
|
||||
Reference in New Issue
Block a user