- 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.
54 lines
1.0 KiB
Dart
54 lines
1.0 KiB
Dart
import 'package:equatable/equatable.dart';
|
|
import '../../data/models/trip.dart';
|
|
|
|
abstract class TripState extends Equatable {
|
|
const TripState();
|
|
|
|
@override
|
|
List<Object?> get props => [];
|
|
}
|
|
|
|
class TripInitial extends TripState {}
|
|
|
|
class TripLoading extends TripState {}
|
|
|
|
class TripLoaded extends TripState {
|
|
final List<Trip> trips;
|
|
|
|
const TripLoaded(this.trips);
|
|
|
|
@override
|
|
List<Object?> get props => [trips];
|
|
}
|
|
|
|
// NOUVEAU : État pour indiquer qu'un voyage a été créé avec succès
|
|
class TripCreated extends TripState {
|
|
final String tripId;
|
|
final String message;
|
|
|
|
const TripCreated({
|
|
required this.tripId,
|
|
this.message = 'Voyage créé avec succès',
|
|
});
|
|
|
|
@override
|
|
List<Object?> get props => [tripId, message];
|
|
}
|
|
|
|
class TripOperationSuccess extends TripState {
|
|
final String message;
|
|
|
|
const TripOperationSuccess(this.message);
|
|
|
|
@override
|
|
List<Object?> get props => [message];
|
|
}
|
|
|
|
class TripError extends TripState {
|
|
final String message;
|
|
|
|
const TripError(this.message);
|
|
|
|
@override
|
|
List<Object?> get props => [message];
|
|
} |