40 lines
880 B
Dart
40 lines
880 B
Dart
import 'package:equatable/equatable.dart';
|
|
import 'package:flux/features/operations/models/operation_model.dart';
|
|
|
|
enum OperationFormStatus {
|
|
initial,
|
|
ready,
|
|
loading,
|
|
saving,
|
|
success,
|
|
successAndAddAnother,
|
|
failure,
|
|
}
|
|
|
|
class OperationFormState extends Equatable {
|
|
final OperationModel operation;
|
|
final OperationFormStatus status;
|
|
final String? errorMessage;
|
|
|
|
const OperationFormState({
|
|
required this.operation,
|
|
this.status = OperationFormStatus.initial,
|
|
this.errorMessage,
|
|
});
|
|
|
|
@override
|
|
List<Object?> get props => [operation, status, errorMessage];
|
|
|
|
OperationFormState copyWith({
|
|
OperationModel? operation,
|
|
OperationFormStatus? status,
|
|
String? errorMessage,
|
|
}) {
|
|
return OperationFormState(
|
|
operation: operation ?? this.operation,
|
|
status: status ?? this.status,
|
|
errorMessage: errorMessage,
|
|
);
|
|
}
|
|
}
|