refactoring

This commit is contained in:
dahoud
2026-03-31 09:14:47 +00:00
parent 9bfffeeebe
commit 5383df6dcb
200 changed files with 11192 additions and 7063 deletions

View File

@@ -1,6 +1,7 @@
/// BLoC pour les demandes d'aide (solidarité)
library solidarity_bloc;
import 'package:dio/dio.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:equatable/equatable.dart';
import 'package:injectable/injectable.dart';
@@ -29,6 +30,7 @@ class SolidarityBloc extends Bloc<SolidarityEvent, SolidarityState> {
final list = await _repository.getMesDemandes(page: event.page, size: event.size);
emit(state.copyWith(status: SolidarityStatus.loaded, demandes: list));
} catch (e) {
if (e is DioException && e.type == DioExceptionType.cancel) return;
emit(state.copyWith(status: SolidarityStatus.error, message: e.toString(), error: e));
}
}
@@ -39,6 +41,7 @@ class SolidarityBloc extends Bloc<SolidarityEvent, SolidarityState> {
final demande = await _repository.getById(event.id);
emit(state.copyWith(status: SolidarityStatus.loaded, demandeDetail: demande));
} catch (e) {
if (e is DioException && e.type == DioExceptionType.cancel) return;
emit(state.copyWith(status: SolidarityStatus.error, message: e.toString(), error: e));
}
}
@@ -54,6 +57,7 @@ class SolidarityBloc extends Bloc<SolidarityEvent, SolidarityState> {
);
emit(state.copyWith(status: SolidarityStatus.loaded, demandes: list));
} catch (e) {
if (e is DioException && e.type == DioExceptionType.cancel) return;
emit(state.copyWith(status: SolidarityStatus.error, message: e.toString(), error: e));
}
}
@@ -64,6 +68,7 @@ class SolidarityBloc extends Bloc<SolidarityEvent, SolidarityState> {
await _repository.create(event.demande);
add(const LoadDemandesAide());
} catch (e) {
if (e is DioException && e.type == DioExceptionType.cancel) return;
emit(state.copyWith(status: SolidarityStatus.error, message: e.toString(), error: e));
}
}
@@ -75,6 +80,7 @@ class SolidarityBloc extends Bloc<SolidarityEvent, SolidarityState> {
emit(state.copyWith(status: SolidarityStatus.loaded, demandeDetail: updated));
add(const LoadDemandesAide());
} catch (e) {
if (e is DioException && e.type == DioExceptionType.cancel) return;
emit(state.copyWith(status: SolidarityStatus.error, message: e.toString(), error: e));
}
}
@@ -86,6 +92,7 @@ class SolidarityBloc extends Bloc<SolidarityEvent, SolidarityState> {
emit(state.copyWith(status: SolidarityStatus.loaded, demandeDetail: updated));
add(const LoadDemandesAide());
} catch (e) {
if (e is DioException && e.type == DioExceptionType.cancel) return;
emit(state.copyWith(status: SolidarityStatus.error, message: e.toString(), error: e));
}
}

View File

@@ -66,7 +66,7 @@ class _DemandeAideDetailPageState extends State<DemandeAideDetailPage> {
);
}
return SingleChildScrollView(
padding: const EdgeInsets.all(16),
padding: const EdgeInsets.all(12),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [