6177214e-ce7c-49e3-99de-ff9721b26f63 — Commit 540d2324
Changed files
comwell_key_app/lib/housekeeping/housekeeping_cubit.dart | 4 ++-- comwell_key_app/lib/housekeeping/housekeeping_state.dart | 11 ++++++++--- 2 files changed, 10 insertions(+), 5 deletions(-)
Diff
diff --git a/comwell_key_app/lib/housekeeping/housekeeping_cubit.dart b/comwell_key_app/lib/housekeeping/housekeeping_cubit.dart
index 41dbf1c6..12d5df3b 100644
--- a/comwell_key_app/lib/housekeeping/housekeeping_cubit.dart
+++ b/comwell_key_app/lib/housekeeping/housekeeping_cubit.dart
@@ -18,13 +18,13 @@ class HouseKeepingCubit extends Cubit<HouseKeepingState> {
void onAddServiceClicked(String service) {
final List<String> updatedServices = List.from(state.selectedServices)
..add(service);
- emit(state.copyWith(selectedServices: updatedServices));
+ emit(state.servicesSelected(selectedServices: updatedServices));
}
void onRemoveServiceClicked(String service) {
final List<String> updatedServices = List.from(state.selectedServices)
..remove(service);
- emit(state.copyWith(selectedServices: updatedServices));
+ emit(state.servicesSelected(selectedServices: updatedServices));
}
void onServiceClicked(String name) {
diff --git a/comwell_key_app/lib/housekeeping/housekeeping_state.dart b/comwell_key_app/lib/housekeeping/housekeeping_state.dart
index 92517156..f48f33bf 100644
--- a/comwell_key_app/lib/housekeeping/housekeeping_state.dart
+++ b/comwell_key_app/lib/housekeeping/housekeeping_state.dart
@@ -1,12 +1,17 @@
class HouseKeepingState {
- final List<String> selectedServices;
+ final Iterable<String> selectedServices;
HouseKeepingState({required this.selectedServices});
HouseKeepingState.initial() : selectedServices = [];
- HouseKeepingState copyWith({
- List<String>? selectedServices,
+ HouseKeepingState servicesSelected({
+ required Iterable<String> selectedServices,
+ }) =>
+ _copyWith(selectedServices: selectedServices);
+
+ HouseKeepingState _copyWith({
+ Iterable<String>? selectedServices,
}) {
return HouseKeepingState(
selectedServices: selectedServices ?? this.selectedServices,