From 8c348f61b1871038440ace13ff61c8614cf62e8a Mon Sep 17 00:00:00 2001 From: mso7nueh Date: Thu, 11 Sep 2025 21:35:28 +0300 Subject: [PATCH] fix(settings): Issue-256 --- .../bloc/settings_cubit/settings_state.dart | 3 +-- .../presentation/pages/settings_screen.dart | 13 ++++++------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/lib/features/settings/presentation/bloc/settings_cubit/settings_state.dart b/lib/features/settings/presentation/bloc/settings_cubit/settings_state.dart index 4b232166..86471f31 100644 --- a/lib/features/settings/presentation/bloc/settings_cubit/settings_state.dart +++ b/lib/features/settings/presentation/bloc/settings_cubit/settings_state.dart @@ -1,6 +1,5 @@ import 'package:eatvio_app/features/consultant/become_consultant/models/consultation_request_model.dart'; import 'package:eatvio_app/features/profile/models/profile_model.dart'; -import 'package:eatvio_app/features/profile/models/profile_details_model.dart'; import 'package:eatvio_app/features/settings/models/profile_settings_model.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; @@ -17,7 +16,7 @@ abstract class SettingsState with _$SettingsState { required ProfileDetailsModel profileDetails, required ProfileModel profile, ConsultationRequestModel? consultationRequestModel, - bool hasActiveConsultation, + required bool hasActiveConsultation, }) = SettingsStateLoaded; const factory SettingsState.error({ diff --git a/lib/features/settings/presentation/pages/settings_screen.dart b/lib/features/settings/presentation/pages/settings_screen.dart index 3e82fab3..ad42a7b4 100644 --- a/lib/features/settings/presentation/pages/settings_screen.dart +++ b/lib/features/settings/presentation/pages/settings_screen.dart @@ -176,7 +176,7 @@ class _SettingsScreenState extends State { _tile( padding: const EdgeInsets.symmetric(horizontal: 16), onTap: () { - if (state.hasActiveConsultation && !moodSwitchState) { + if (state.hasActiveConsultation) { _showConsultationWarning(); return; } @@ -187,10 +187,10 @@ class _SettingsScreenState extends State { }, title: 'Указывать "настроение" в заполнение дневника', trailing: CupertinoSwitch( - value: moodSwitchState, + value: state.hasActiveConsultation ? true : moodSwitchState, activeTrackColor: appTheme.blueA400, onChanged: (newValue) { - if (state.hasActiveConsultation && !newValue) { + if (state.hasActiveConsultation) { _showConsultationWarning(); return; } @@ -205,8 +205,7 @@ class _SettingsScreenState extends State { _tile( padding: const EdgeInsets.symmetric(horizontal: 16), onTap: () { - - if (state.hasActiveConsultation && !bedTimeSwitchState) { + if (state.hasActiveConsultation) { _showConsultationWarning(); return; } @@ -217,10 +216,10 @@ class _SettingsScreenState extends State { }, title: 'Указывать "отход ко сну" в заполнение дневника', trailing: CupertinoSwitch( - value: bedTimeSwitchState, + value: state.hasActiveConsultation ? true : bedTimeSwitchState, activeTrackColor: appTheme.blueA400, onChanged: (newValue) { - if (state.hasActiveConsultation && !newValue) { + if (state.hasActiveConsultation) { _showConsultationWarning(); return; }