- Updated ActivityCard layout for better visual consistency and responsiveness. - Simplified the category badge and adjusted styles for better readability. - Enhanced the voting section with a progress bar and improved button designs. - Added a new method in Activity model to check if all trip participants approved an activity. - Improved error handling and validation in ActivityRepository for voting and fetching activities. - Implemented pagination in ActivityPlacesService for activity searches. - Removed outdated scripts for cleaning up duplicate images.
87 lines
2.2 KiB
Dart
87 lines
2.2 KiB
Dart
import 'package:equatable/equatable.dart';
|
|
import '../../../models/activity.dart';
|
|
|
|
/// States pour les activités Google Places
|
|
abstract class GoogleActivityState extends Equatable {
|
|
const GoogleActivityState();
|
|
|
|
@override
|
|
List<Object?> get props => [];
|
|
}
|
|
|
|
/// État initial
|
|
class GoogleActivityInitial extends GoogleActivityState {
|
|
const GoogleActivityInitial();
|
|
}
|
|
|
|
/// État de recherche
|
|
class GoogleActivitySearching extends GoogleActivityState {
|
|
const GoogleActivitySearching();
|
|
}
|
|
|
|
/// État avec les activités Google chargées
|
|
class GoogleActivityLoaded extends GoogleActivityState {
|
|
final List<Activity> googleActivities;
|
|
final String? nextPageToken;
|
|
final bool hasMoreData;
|
|
final String query;
|
|
|
|
const GoogleActivityLoaded({
|
|
required this.googleActivities,
|
|
this.nextPageToken,
|
|
required this.hasMoreData,
|
|
required this.query,
|
|
});
|
|
|
|
@override
|
|
List<Object?> get props => [googleActivities, nextPageToken, hasMoreData, query];
|
|
|
|
/// Créer une copie avec des modifications
|
|
GoogleActivityLoaded copyWith({
|
|
List<Activity>? googleActivities,
|
|
String? nextPageToken,
|
|
bool? hasMoreData,
|
|
String? query,
|
|
}) {
|
|
return GoogleActivityLoaded(
|
|
googleActivities: googleActivities ?? this.googleActivities,
|
|
nextPageToken: nextPageToken ?? this.nextPageToken,
|
|
hasMoreData: hasMoreData ?? this.hasMoreData,
|
|
query: query ?? this.query,
|
|
);
|
|
}
|
|
}
|
|
|
|
/// État de chargement de plus d'activités (pagination)
|
|
class GoogleActivityLoadingMore extends GoogleActivityState {
|
|
final List<Activity> currentActivities;
|
|
final String query;
|
|
|
|
const GoogleActivityLoadingMore({
|
|
required this.currentActivities,
|
|
required this.query,
|
|
});
|
|
|
|
@override
|
|
List<Object?> get props => [currentActivities, query];
|
|
}
|
|
|
|
/// État de succès d'opération
|
|
class GoogleActivityOperationSuccess extends GoogleActivityState {
|
|
final String message;
|
|
|
|
const GoogleActivityOperationSuccess(this.message);
|
|
|
|
@override
|
|
List<Object?> get props => [message];
|
|
}
|
|
|
|
/// État d'erreur
|
|
class GoogleActivityError extends GoogleActivityState {
|
|
final String message;
|
|
|
|
const GoogleActivityError(this.message);
|
|
|
|
@override
|
|
List<Object?> get props => [message];
|
|
} |