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:
@@ -17,7 +17,7 @@ class TripService {
|
||||
|
||||
return querySnapshot.docs.map((doc) {
|
||||
final data = doc.data() as Map<String, dynamic>;
|
||||
return Trip.fromMap({...data, 'id': doc.id});
|
||||
return Trip.fromMap({...data, 'id': doc.id}, doc.id);
|
||||
}).toList();
|
||||
} catch (e) {
|
||||
_errorService.logError('Erreur lors du chargement des voyages: $e', StackTrace.current);
|
||||
@@ -176,7 +176,7 @@ class TripService {
|
||||
processedData['description'] = processedData['description'] ?? '';
|
||||
processedData['status'] = processedData['status'] ?? 'draft';
|
||||
|
||||
final trip = Trip.fromMap(processedData);
|
||||
final trip = Trip.fromMap(processedData, docId);
|
||||
return trip;
|
||||
|
||||
} catch (e, stackTrace) {
|
||||
@@ -224,7 +224,7 @@ class TripService {
|
||||
|
||||
if (doc.exists) {
|
||||
final data = doc.data() as Map<String, dynamic>;
|
||||
return Trip.fromMap({...data, 'id': doc.id});
|
||||
return Trip.fromMap({...data, 'id': doc.id}, doc.id);
|
||||
}
|
||||
return null;
|
||||
} catch (e) {
|
||||
|
||||
Reference in New Issue
Block a user