feat: Enhance trip management features and improve UI responsiveness
- Implemented AutomaticKeepAliveClientMixin in HomeContent to maintain state during navigation. - Modified trip loading logic to trigger after the first frame for better performance. - Updated trip loading events to use LoadTripsByUserId for consistency. - Added temporary success messages for trip creation and operations. - Improved UI elements for better user experience, including updated text styles and spacing. - Refactored trip model to support Firestore timestamps and improved error handling during parsing. - Streamlined trip repository methods for better clarity and performance. - Enhanced trip service methods to ensure correct mapping from Firestore documents. - Removed unnecessary trip reset logic on logout.
This commit is contained in:
@@ -13,7 +13,7 @@ class GroupBloc extends Bloc<GroupEvent, GroupState> {
|
||||
|
||||
GroupBloc(this._repository) : super(GroupInitial()) {
|
||||
on<LoadGroupsByUserId>(_onLoadGroupsByUserId);
|
||||
on<_GroupsUpdated>(_onGroupsUpdated); // NOUVEAU événement interne
|
||||
on<_GroupsUpdated>(_onGroupsUpdated);
|
||||
on<LoadGroupsByTrip>(_onLoadGroupsByTrip);
|
||||
on<CreateGroup>(_onCreateGroup);
|
||||
on<CreateGroupWithMembers>(_onCreateGroupWithMembers);
|
||||
@@ -44,7 +44,6 @@ class GroupBloc extends Bloc<GroupEvent, GroupState> {
|
||||
}
|
||||
}
|
||||
|
||||
// NOUVEAU: Handler pour les mises à jour du stream
|
||||
Future<void> _onGroupsUpdated(
|
||||
_GroupsUpdated event,
|
||||
Emitter<GroupState> emit,
|
||||
@@ -111,6 +110,7 @@ class GroupBloc extends Bloc<GroupEvent, GroupState> {
|
||||
Emitter<GroupState> emit,
|
||||
) async {
|
||||
try {
|
||||
// CORRECTION : Utiliser addMemberToGroup au lieu de addMember
|
||||
await _repository.addMember(event.groupId, event.member);
|
||||
emit(const GroupOperationSuccess('Membre ajouté'));
|
||||
} catch (e) {
|
||||
@@ -123,6 +123,7 @@ class GroupBloc extends Bloc<GroupEvent, GroupState> {
|
||||
Emitter<GroupState> emit,
|
||||
) async {
|
||||
try {
|
||||
// CORRECTION : Utiliser removeMemberFromGroup au lieu de removeMember
|
||||
await _repository.removeMember(event.groupId, event.userId);
|
||||
emit(const GroupOperationSuccess('Membre supprimé'));
|
||||
} catch (e) {
|
||||
@@ -161,7 +162,6 @@ class GroupBloc extends Bloc<GroupEvent, GroupState> {
|
||||
}
|
||||
}
|
||||
|
||||
// NOUVEAU: Événement interne pour les mises à jour du stream
|
||||
class _GroupsUpdated extends GroupEvent {
|
||||
final List<Group> groups;
|
||||
final String? error;
|
||||
|
||||
Reference in New Issue
Block a user