43 lines
1.2 KiB
Dart
43 lines
1.2 KiB
Dart
import '../../domain/entities/client_notification.dart';
|
|
|
|
enum NotificationsStatus { initial, loading, loadingMore, success, failure }
|
|
|
|
class NotificationsState {
|
|
final NotificationsStatus status;
|
|
final List<ClientNotification> notifications;
|
|
final String? errorMessage;
|
|
final int currentPage;
|
|
final int totalPages;
|
|
final bool hasMore;
|
|
final bool isLoadingMore;
|
|
|
|
const NotificationsState({
|
|
this.status = NotificationsStatus.initial,
|
|
this.notifications = const [],
|
|
this.errorMessage,
|
|
this.currentPage = 1,
|
|
this.totalPages = 1,
|
|
this.hasMore = true,
|
|
this.isLoadingMore = false,
|
|
});
|
|
|
|
NotificationsState copyWith({
|
|
NotificationsStatus? status,
|
|
List<ClientNotification>? notifications,
|
|
String? errorMessage,
|
|
int? currentPage,
|
|
int? totalPages,
|
|
bool? hasMore,
|
|
bool? isLoadingMore,
|
|
}) {
|
|
return NotificationsState(
|
|
status: status ?? this.status,
|
|
notifications: notifications ?? this.notifications,
|
|
errorMessage: errorMessage ?? this.errorMessage,
|
|
currentPage: currentPage ?? this.currentPage,
|
|
totalPages: totalPages ?? this.totalPages,
|
|
hasMore: hasMore ?? this.hasMore,
|
|
isLoadingMore: isLoadingMore ?? this.isLoadingMore,
|
|
);
|
|
}
|
|
} |