j
This commit is contained in:
@@ -1,39 +1,48 @@
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:flux/features/operations/models/operation_model.dart';
|
||||
part of 'operation_form_cubit.dart';
|
||||
|
||||
enum OperationFormStatus {
|
||||
initial,
|
||||
ready,
|
||||
loading,
|
||||
ready,
|
||||
saving,
|
||||
success,
|
||||
successAndAddAnother,
|
||||
successAndAddAnother, // Nuovo stato in stile Ticket!
|
||||
failure,
|
||||
}
|
||||
|
||||
class OperationFormState extends Equatable {
|
||||
final OperationModel operation;
|
||||
final OperationFormStatus status;
|
||||
final OperationModel operation;
|
||||
final String? errorMessage;
|
||||
// Teniamo traccia delle operazioni salvate in questa sessione (per UI riepilogo)
|
||||
final List<OperationModel> savedBatchOperations;
|
||||
|
||||
const OperationFormState({
|
||||
required this.operation,
|
||||
this.status = OperationFormStatus.initial,
|
||||
required this.operation,
|
||||
this.errorMessage,
|
||||
this.savedBatchOperations = const [],
|
||||
});
|
||||
|
||||
@override
|
||||
List<Object?> get props => [operation, status, errorMessage];
|
||||
|
||||
OperationFormState copyWith({
|
||||
OperationModel? operation,
|
||||
OperationFormStatus? status,
|
||||
OperationModel? operation,
|
||||
String? errorMessage,
|
||||
List<OperationModel>? savedBatchOperations,
|
||||
}) {
|
||||
return OperationFormState(
|
||||
operation: operation ?? this.operation,
|
||||
status: status ?? this.status,
|
||||
operation: operation ?? this.operation,
|
||||
errorMessage: errorMessage,
|
||||
savedBatchOperations: savedBatchOperations ?? this.savedBatchOperations,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
List<Object?> get props => [
|
||||
status,
|
||||
operation,
|
||||
errorMessage,
|
||||
savedBatchOperations,
|
||||
];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user