54 lines
1.2 KiB
Dart
54 lines
1.2 KiB
Dart
import 'package:equatable/equatable.dart';
|
|
import 'package:flux/features/tickets/models/ticket_model.dart';
|
|
import 'package:flux/features/tickets/models/ticket_notification_result.dart';
|
|
|
|
enum TicketFormStatus {
|
|
initial,
|
|
ready,
|
|
loading,
|
|
saving,
|
|
success,
|
|
pop,
|
|
failure,
|
|
deleted,
|
|
}
|
|
|
|
class TicketFormState extends Equatable {
|
|
final TicketModel ticket;
|
|
final TicketFormStatus status;
|
|
final String? errorMessage;
|
|
final TicketNotificationResult? notificationResult;
|
|
|
|
const TicketFormState({
|
|
required this.ticket,
|
|
this.status = TicketFormStatus.initial,
|
|
this.errorMessage,
|
|
this.notificationResult,
|
|
});
|
|
|
|
@override
|
|
List<Object?> get props => [
|
|
ticket,
|
|
status,
|
|
errorMessage,
|
|
notificationResult,
|
|
];
|
|
|
|
TicketFormState copyWith({
|
|
TicketModel? ticket,
|
|
TicketFormStatus? status,
|
|
String? errorMessage,
|
|
TicketNotificationResult? notificationResult,
|
|
bool clearNotificationResult = false,
|
|
}) {
|
|
return TicketFormState(
|
|
ticket: ticket ?? this.ticket,
|
|
status: status ?? this.status,
|
|
errorMessage: errorMessage,
|
|
notificationResult: clearNotificationResult
|
|
? null
|
|
: (notificationResult ?? this.notificationResult),
|
|
);
|
|
}
|
|
}
|