Refactoring - Version OK
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../../core/models/membre_search_criteria.dart';
|
||||
import '../../../../core/models/membre_search_result.dart';
|
||||
import '../../../../shared/models/membre_search_criteria.dart';
|
||||
import '../../../../shared/models/membre_search_result.dart';
|
||||
import '../widgets/membre_search_results.dart';
|
||||
import '../widgets/search_statistics_card.dart';
|
||||
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
|
||||
import '../../../../core/auth/bloc/auth_bloc.dart';
|
||||
import '../../../../core/auth/models/user_role.dart';
|
||||
import '../../../../core/design_system/tokens/tokens.dart';
|
||||
import '../../../../shared/design_system/unionflow_design_system.dart';
|
||||
import '../../../../features/authentication/presentation/bloc/auth_bloc.dart';
|
||||
import '../../../../features/authentication/data/models/user_role.dart';
|
||||
|
||||
/// Page de gestion des membres - Interface sophistiquée et exhaustive
|
||||
///
|
||||
@@ -25,12 +24,12 @@ class _MembersPageState extends State<MembersPage> with TickerProviderStateMixin
|
||||
// État de l'interface
|
||||
String _searchQuery = '';
|
||||
String _selectedFilter = 'Tous';
|
||||
String _selectedSort = 'Nom';
|
||||
|
||||
bool _isGridView = false;
|
||||
bool _showAdvancedFilters = false;
|
||||
|
||||
// Filtres avancés
|
||||
List<String> _selectedRoles = [];
|
||||
final List<String> _selectedRoles = [];
|
||||
List<String> _selectedStatuses = ['Actif', 'Inactif', 'Suspendu', 'En attente'];
|
||||
DateTimeRange? _dateRange;
|
||||
|
||||
@@ -223,102 +222,29 @@ class _MembersPageState extends State<MembersPage> with TickerProviderStateMixin
|
||||
Widget _buildMembersHeader(AuthAuthenticated state) {
|
||||
final canManageMembers = _canManageMembers(state.effectiveRole);
|
||||
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
gradient: const LinearGradient(
|
||||
colors: [Color(0xFF6C5CE7), Color(0xFF5A4FCF)],
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: const Color(0xFF6C5CE7).withOpacity(0.3),
|
||||
blurRadius: 20,
|
||||
offset: const Offset(0, 8),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.all(12),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white.withOpacity(0.2),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: const Icon(
|
||||
Icons.people,
|
||||
color: Colors.white,
|
||||
size: 24,
|
||||
),
|
||||
return UFPageHeader(
|
||||
title: 'Membres',
|
||||
icon: Icons.people,
|
||||
iconColor: ColorTokens.primary,
|
||||
actions: canManageMembers
|
||||
? [
|
||||
IconButton(
|
||||
icon: const Icon(Icons.checklist),
|
||||
onPressed: () => _showBulkActions(),
|
||||
tooltip: 'Actions groupées',
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const Text(
|
||||
'Gestion des Membres',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'Interface complète de gestion des membres',
|
||||
style: TextStyle(
|
||||
color: Colors.white.withOpacity(0.8),
|
||||
fontSize: 14,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.download),
|
||||
onPressed: () => _exportMembers(),
|
||||
tooltip: 'Exporter',
|
||||
),
|
||||
if (canManageMembers) ...[
|
||||
IconButton(
|
||||
onPressed: () => _showBulkActions(),
|
||||
icon: const Icon(Icons.checklist, color: Colors.white),
|
||||
tooltip: 'Actions groupées',
|
||||
),
|
||||
IconButton(
|
||||
onPressed: () => _exportMembers(),
|
||||
icon: const Icon(Icons.download, color: Colors.white),
|
||||
tooltip: 'Exporter',
|
||||
),
|
||||
IconButton(
|
||||
onPressed: () => _showAddMemberDialog(),
|
||||
icon: const Icon(Icons.person_add, color: Colors.white),
|
||||
tooltip: 'Ajouter un membre',
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.access_time,
|
||||
color: Colors.white.withOpacity(0.8),
|
||||
size: 16,
|
||||
IconButton(
|
||||
icon: const Icon(Icons.person_add),
|
||||
onPressed: () => _showAddMemberDialog(),
|
||||
tooltip: 'Ajouter un membre',
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
'Dernière mise à jour: ${_formatDateTime(DateTime.now())}',
|
||||
style: TextStyle(
|
||||
color: Colors.white.withOpacity(0.8),
|
||||
fontSize: 12,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
]
|
||||
: null,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -353,7 +279,7 @@ class _MembersPageState extends State<MembersPage> with TickerProviderStateMixin
|
||||
child: _buildMetricCard(
|
||||
'Total Membres',
|
||||
totalMembers.toString(),
|
||||
'+${newThisMonth} ce mois',
|
||||
'+$newThisMonth ce mois',
|
||||
Icons.people,
|
||||
const Color(0xFF6C5CE7),
|
||||
trend: newThisMonth > 0 ? 'up' : 'stable',
|
||||
@@ -441,11 +367,11 @@ class _MembersPageState extends State<MembersPage> with TickerProviderStateMixin
|
||||
),
|
||||
const Spacer(),
|
||||
if (trend == 'up')
|
||||
Icon(Icons.trending_up, color: Colors.green, size: 16)
|
||||
const Icon(Icons.trending_up, color: Colors.green, size: 16)
|
||||
else if (trend == 'down')
|
||||
Icon(Icons.trending_down, color: Colors.red, size: 16)
|
||||
const Icon(Icons.trending_down, color: Colors.red, size: 16)
|
||||
else
|
||||
Icon(Icons.trending_flat, color: Colors.grey, size: 16),
|
||||
const Icon(Icons.trending_flat, color: Colors.grey, size: 16),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
@@ -811,7 +737,7 @@ class _MembersPageState extends State<MembersPage> with TickerProviderStateMixin
|
||||
|
||||
/// Carte de membre sophistiquée pour la vue liste
|
||||
Widget _buildMemberCard(Map<String, dynamic> member) {
|
||||
final isActive = member['status'] == 'Actif';
|
||||
|
||||
final joinDate = member['joinDate'] as DateTime;
|
||||
final lastActivity = member['lastActivity'] as DateTime;
|
||||
final contributionScore = member['contributionScore'] as int;
|
||||
@@ -1184,10 +1110,7 @@ class _MembersPageState extends State<MembersPage> with TickerProviderStateMixin
|
||||
}
|
||||
}
|
||||
|
||||
/// Formate une date et heure
|
||||
String _formatDateTime(DateTime dateTime) {
|
||||
return '${_formatDate(dateTime)} à ${dateTime.hour.toString().padLeft(2, '0')}:${dateTime.minute.toString().padLeft(2, '0')}';
|
||||
}
|
||||
|
||||
|
||||
/// Vérifie si l'utilisateur peut gérer les membres
|
||||
bool _canManageMembers(UserRole role) {
|
||||
@@ -1464,7 +1387,7 @@ class _MembersPageState extends State<MembersPage> with TickerProviderStateMixin
|
||||
|
||||
/// État vide quand aucun membre ne correspond aux filtres
|
||||
Widget _buildEmptyState() {
|
||||
return Container(
|
||||
return SizedBox(
|
||||
height: 400,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
|
||||
@@ -7,8 +7,8 @@ library members_page_connected;
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
|
||||
import '../../../../core/auth/bloc/auth_bloc.dart';
|
||||
import '../../../../core/auth/models/user_role.dart';
|
||||
import '../../../../features/authentication/presentation/bloc/auth_bloc.dart';
|
||||
import '../../../../features/authentication/data/models/user_role.dart';
|
||||
import '../../../../core/utils/logger.dart';
|
||||
import '../widgets/add_member_dialog.dart';
|
||||
import '../../bloc/membres_bloc.dart';
|
||||
@@ -52,15 +52,15 @@ class _MembersPageWithDataState extends State<MembersPageWithData>
|
||||
|
||||
// État de l'interface
|
||||
String _searchQuery = '';
|
||||
String _selectedFilter = 'Tous';
|
||||
final String _selectedSort = 'Nom';
|
||||
|
||||
|
||||
bool _isGridView = false;
|
||||
bool _showAdvancedFilters = false;
|
||||
|
||||
|
||||
// Filtres avancés
|
||||
final List<String> _selectedRoles = [];
|
||||
List<String> _selectedStatuses = ['Actif', 'Inactif', 'Suspendu', 'En attente'];
|
||||
DateTimeRange? _dateRange;
|
||||
|
||||
final List<String> _selectedStatuses = ['Actif', 'Inactif', 'Suspendu', 'En attente'];
|
||||
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@@ -740,12 +740,7 @@ class MembersPageWithDataAndPagination extends StatefulWidget {
|
||||
|
||||
class _MembersPageWithDataAndPaginationState extends State<MembersPageWithDataAndPagination> {
|
||||
final TextEditingController _searchController = TextEditingController();
|
||||
late TabController _tabController;
|
||||
String _searchQuery = '';
|
||||
String _selectedFilter = 'Tous';
|
||||
bool _isGridView = false;
|
||||
final List<String> _selectedRoles = [];
|
||||
List<String> _selectedStatuses = ['Actif', 'Inactif', 'Suspendu', 'En attente'];
|
||||
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
|
||||
@@ -8,8 +8,8 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:get_it/get_it.dart';
|
||||
|
||||
import '../../../../core/widgets/error_widget.dart';
|
||||
import '../../../../core/widgets/loading_widget.dart';
|
||||
import '../../../../shared/widgets/error_widget.dart';
|
||||
import '../../../../shared/widgets/loading_widget.dart';
|
||||
import '../../../../core/utils/logger.dart';
|
||||
import '../../bloc/membres_bloc.dart';
|
||||
import '../../bloc/membres_event.dart';
|
||||
|
||||
Reference in New Issue
Block a user