refactoring
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
library event_detail_page;
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import '../../../../shared/design_system/tokens/app_colors.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import '../../../../core/di/injection.dart';
|
||||
import '../../bloc/evenements_bloc.dart';
|
||||
@@ -52,7 +53,7 @@ class _EventDetailPageState extends State<EventDetailPage> {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('Détails de l\'événement'),
|
||||
backgroundColor: const Color(0xFF3B82F6),
|
||||
backgroundColor: AppColors.primaryGreen,
|
||||
foregroundColor: Colors.white,
|
||||
actions: [
|
||||
IconButton(
|
||||
@@ -85,12 +86,12 @@ class _EventDetailPageState extends State<EventDetailPage> {
|
||||
Widget _buildHeader() {
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.all(24),
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [
|
||||
const Color(0xFF3B82F6),
|
||||
const Color(0xFF3B82F6).withOpacity(0.8),
|
||||
AppColors.primaryGreen,
|
||||
AppColors.primaryGreen.withOpacity(0.8),
|
||||
],
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
@@ -100,10 +101,10 @@ class _EventDetailPageState extends State<EventDetailPage> {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 6),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white.withOpacity(0.2),
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: Text(
|
||||
_getTypeLabel(widget.evenement.type),
|
||||
@@ -150,7 +151,7 @@ class _EventDetailPageState extends State<EventDetailPage> {
|
||||
|
||||
Widget _buildInfoSection() {
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
padding: const EdgeInsets.all(10),
|
||||
child: Column(
|
||||
children: [
|
||||
_buildInfoRow(
|
||||
@@ -190,7 +191,7 @@ class _EventDetailPageState extends State<EventDetailPage> {
|
||||
padding: const EdgeInsets.symmetric(vertical: 8),
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(icon, color: const Color(0xFF3B82F6), size: 20),
|
||||
Icon(icon, color: AppColors.primaryGreen, size: 20),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: Column(
|
||||
@@ -223,14 +224,14 @@ class _EventDetailPageState extends State<EventDetailPage> {
|
||||
if (widget.evenement.description == null) return const SizedBox.shrink();
|
||||
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
padding: const EdgeInsets.all(10),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const Text(
|
||||
'Description',
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
@@ -246,21 +247,21 @@ class _EventDetailPageState extends State<EventDetailPage> {
|
||||
|
||||
Widget _buildLocationSection() {
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
padding: const EdgeInsets.all(10),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const Text(
|
||||
'Lieu',
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Row(
|
||||
children: [
|
||||
const Icon(Icons.location_on, color: Color(0xFF3B82F6)),
|
||||
const Icon(Icons.location_on, color: AppColors.primaryGreen),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: Text(
|
||||
@@ -277,7 +278,7 @@ class _EventDetailPageState extends State<EventDetailPage> {
|
||||
|
||||
Widget _buildParticipantsSection() {
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
padding: const EdgeInsets.all(10),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
@@ -287,7 +288,7 @@ class _EventDetailPageState extends State<EventDetailPage> {
|
||||
const Text(
|
||||
'Participants',
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
@@ -334,7 +335,7 @@ class _EventDetailPageState extends State<EventDetailPage> {
|
||||
if (!isComplet) {
|
||||
return FloatingActionButton.extended(
|
||||
onPressed: () => _showInscriptionDialog(context, isInscrit),
|
||||
backgroundColor: const Color(0xFF3B82F6),
|
||||
backgroundColor: AppColors.primaryGreen,
|
||||
icon: const Icon(Icons.check),
|
||||
label: const Text('S\'inscrire'),
|
||||
);
|
||||
@@ -424,17 +425,17 @@ class _EventDetailPageState extends State<EventDetailPage> {
|
||||
Color _getStatutColor(StatutEvenement statut) {
|
||||
switch (statut) {
|
||||
case StatutEvenement.planifie:
|
||||
return Colors.blue;
|
||||
return AppColors.info;
|
||||
case StatutEvenement.confirme:
|
||||
return Colors.green;
|
||||
return AppColors.success;
|
||||
case StatutEvenement.enCours:
|
||||
return Colors.orange;
|
||||
return AppColors.warning;
|
||||
case StatutEvenement.termine:
|
||||
return Colors.grey;
|
||||
return AppColors.textSecondaryLight;
|
||||
case StatutEvenement.annule:
|
||||
return Colors.red;
|
||||
return AppColors.error;
|
||||
case StatutEvenement.reporte:
|
||||
return Colors.purple;
|
||||
return AppColors.brandGreen;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ class _EventsPageWithDataState extends State<EventsPageWithData> with TickerProv
|
||||
final total = widget.totalCount;
|
||||
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(20),
|
||||
padding: const EdgeInsets.all(12),
|
||||
decoration: BoxDecoration(
|
||||
color: UnionFlowColors.surface,
|
||||
border: Border(bottom: BorderSide(color: UnionFlowColors.border.withOpacity(0.5), width: 1)),
|
||||
@@ -224,9 +224,9 @@ class _EventsPageWithDataState extends State<EventsPageWithData> with TickerProv
|
||||
onRefresh: () async => context.read<EvenementsBloc>().add(const LoadEvenements()),
|
||||
color: UnionFlowColors.unionGreen,
|
||||
child: ListView.separated(
|
||||
padding: const EdgeInsets.all(16),
|
||||
padding: const EdgeInsets.all(12),
|
||||
itemCount: filtered.length,
|
||||
separatorBuilder: (_, __) => const SizedBox(height: 12),
|
||||
separatorBuilder: (_, __) => const SizedBox(height: 6),
|
||||
itemBuilder: (context, index) => _buildEventCard(filtered[index]),
|
||||
),
|
||||
);
|
||||
@@ -238,11 +238,10 @@ class _EventsPageWithDataState extends State<EventsPageWithData> with TickerProv
|
||||
return GestureDetector(
|
||||
onTap: () => _showEventDetails(event),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 7),
|
||||
decoration: BoxDecoration(
|
||||
color: UnionFlowColors.surface,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
boxShadow: UnionFlowColors.softShadow,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
border: Border(left: BorderSide(color: _getStatutColor(event.statut), width: 4)),
|
||||
),
|
||||
child: Column(
|
||||
@@ -331,11 +330,11 @@ class _EventsPageWithDataState extends State<EventsPageWithData> with TickerProv
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.all(24),
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: const BoxDecoration(color: UnionFlowColors.goldPale, shape: BoxShape.circle),
|
||||
child: const Icon(Icons.event_busy, size: 64, color: UnionFlowColors.gold),
|
||||
child: const Icon(Icons.event_busy, size: 40, color: UnionFlowColors.gold),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
const SizedBox(height: 12),
|
||||
Text('Aucun événement $type', style: const TextStyle(fontSize: 16, fontWeight: FontWeight.w700, color: UnionFlowColors.textPrimary)),
|
||||
const SizedBox(height: 8),
|
||||
Text(_searchQuery.isEmpty ? 'La liste est vide pour le moment' : 'Essayez une autre recherche', style: const TextStyle(fontSize: 13, color: UnionFlowColors.textSecondary)),
|
||||
|
||||
Reference in New Issue
Block a user