forked from eatvio/eatvio_app
fix(settings): Issue-256
This commit is contained in:
@@ -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({
|
||||
|
||||
@@ -176,7 +176,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
||||
_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<SettingsScreen> {
|
||||
},
|
||||
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<SettingsScreen> {
|
||||
_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<SettingsScreen> {
|
||||
},
|
||||
title: 'Указывать "отход ко сну" в заполнение дневника',
|
||||
trailing: CupertinoSwitch(
|
||||
value: bedTimeSwitchState,
|
||||
value: state.hasActiveConsultation ? true : bedTimeSwitchState,
|
||||
activeTrackColor: appTheme.blueA400,
|
||||
onChanged: (newValue) {
|
||||
if (state.hasActiveConsultation && !newValue) {
|
||||
if (state.hasActiveConsultation) {
|
||||
_showConsultationWarning();
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user