a
This commit is contained in:
39
lib/features/operations/blocs/operation_form_state.dart
Normal file
39
lib/features/operations/blocs/operation_form_state.dart
Normal file
@@ -0,0 +1,39 @@
|
||||
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,
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user