refined responsive ui for dashboard and start customer work
This commit is contained in:
40
lib/features/customers/blocs/customer_state.dart
Normal file
40
lib/features/customers/blocs/customer_state.dart
Normal file
@@ -0,0 +1,40 @@
|
||||
part of 'customer_bloc.dart';
|
||||
|
||||
enum CustomerStatus { initial, loading, success, failure }
|
||||
|
||||
class CustomerState extends Equatable {
|
||||
final CustomerStatus status;
|
||||
final List<CustomerModel> customers; // Per la lista generale
|
||||
final CustomerModel?
|
||||
lastCreatedCustomer; // <--- Fondamentale per la Dialog "al volo"
|
||||
final String? errorMessage;
|
||||
|
||||
const CustomerState({
|
||||
this.status = CustomerStatus.initial,
|
||||
this.customers = const [],
|
||||
this.lastCreatedCustomer,
|
||||
this.errorMessage,
|
||||
});
|
||||
|
||||
CustomerState copyWith({
|
||||
CustomerStatus? status,
|
||||
List<CustomerModel>? customers,
|
||||
CustomerModel? lastCreatedCustomer,
|
||||
String? errorMessage,
|
||||
}) {
|
||||
return CustomerState(
|
||||
status: status ?? this.status,
|
||||
customers: customers ?? this.customers,
|
||||
lastCreatedCustomer: lastCreatedCustomer ?? this.lastCreatedCustomer,
|
||||
errorMessage: errorMessage ?? this.errorMessage,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
List<Object?> get props => [
|
||||
status,
|
||||
customers,
|
||||
lastCreatedCustomer,
|
||||
errorMessage,
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user