forked from eatvio/eatvio_app
feat: settings
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import 'package:eatvio_app/features/profile/models/profile_model.dart';
|
||||
import 'package:eatvio_app/features/profile/repositories/profile_repository.dart';
|
||||
import 'package:eatvio_app/features/settings/models/profile_settings_model.dart';
|
||||
import 'package:eatvio_app/features/settings/presentation/bloc/settings_cubit/settings_state.dart';
|
||||
@@ -24,6 +25,19 @@ class SettingsCubit extends Cubit<SettingsState> {
|
||||
}
|
||||
}
|
||||
|
||||
updateProfileDetails({
|
||||
required ProfileDetailsModel profileDetailsModel
|
||||
}) async {
|
||||
try {
|
||||
await settingsRepository.updateProfileDetails(
|
||||
profileDetailsModel: profileDetailsModel,
|
||||
);
|
||||
} catch (e) {
|
||||
print(e);
|
||||
rethrow;
|
||||
}
|
||||
}
|
||||
|
||||
updateProfileSettings({
|
||||
required ProfileSettingsModel profileSettingsModel
|
||||
}) async {
|
||||
|
||||
@@ -9,10 +9,12 @@ import 'package:go_router/go_router.dart';
|
||||
|
||||
class GeneralInfoScreen extends StatefulWidget {
|
||||
final ProfileDetailsModel profileDetailsModel;
|
||||
final bool isPublicProfile;
|
||||
|
||||
const GeneralInfoScreen({
|
||||
super.key,
|
||||
required this.profileDetailsModel,
|
||||
required this.isPublicProfile,
|
||||
});
|
||||
|
||||
@override
|
||||
@@ -22,7 +24,12 @@ class GeneralInfoScreen extends StatefulWidget {
|
||||
class _GeneralInfoScreenState extends State<GeneralInfoScreen> {
|
||||
final firstNameController = TextEditingController();
|
||||
final lastNameController = TextEditingController();
|
||||
final genderController = TextEditingController();
|
||||
final countryController = TextEditingController();
|
||||
final cityController = TextEditingController();
|
||||
final languageController = TextEditingController();
|
||||
late DateTime selectedDate;
|
||||
late bool isPublicProfile;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@@ -31,6 +38,11 @@ class _GeneralInfoScreenState extends State<GeneralInfoScreen> {
|
||||
firstNameController.text = widget.profileDetailsModel.firstName;
|
||||
lastNameController.text = widget.profileDetailsModel.lastName;
|
||||
selectedDate = DateTime.parse(widget.profileDetailsModel.birthdate);
|
||||
genderController.text = widget.profileDetailsModel.gender;
|
||||
countryController.text = widget.profileDetailsModel.country;
|
||||
cityController.text = widget.profileDetailsModel.city;
|
||||
languageController.text = widget.profileDetailsModel.lang;
|
||||
isPublicProfile = widget.isPublicProfile;
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -73,35 +85,35 @@ class _GeneralInfoScreenState extends State<GeneralInfoScreen> {
|
||||
Text('Пол'),
|
||||
SizedBox(height: 4),
|
||||
CustomTextFormField(
|
||||
initialValue: 'Мужской',
|
||||
controller: genderController,
|
||||
onChanged: (newValue) {},
|
||||
),
|
||||
SizedBox(height: 16),
|
||||
Text('Страна'),
|
||||
SizedBox(height: 4),
|
||||
CustomTextFormField(
|
||||
initialValue: 'Россия',
|
||||
controller: countryController,
|
||||
onChanged: (newValue) {},
|
||||
),
|
||||
SizedBox(height: 16),
|
||||
Text('Город'),
|
||||
SizedBox(height: 4),
|
||||
CustomTextFormField(
|
||||
initialValue: 'Москва',
|
||||
controller: cityController,
|
||||
onChanged: (newValue) {},
|
||||
),
|
||||
SizedBox(height: 16),
|
||||
Text('Предпочтительный язык общения'),
|
||||
SizedBox(height: 4),
|
||||
CustomTextFormField(
|
||||
initialValue: 'Русский',
|
||||
controller: languageController,
|
||||
onChanged: (newValue) {},
|
||||
),
|
||||
SizedBox(height: 16),
|
||||
Text('Показывать анкету'),
|
||||
SizedBox(height: 4),
|
||||
CustomTextFormField(
|
||||
initialValue: 'Всем',
|
||||
initialValue: isPublicProfile ? 'Всем' : 'Только зарегистрированным',
|
||||
onChanged: (newValue) {},
|
||||
),
|
||||
],
|
||||
|
||||
@@ -18,6 +18,24 @@ class OtherInfoScreen extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _OtherInfoScreenState extends State<OtherInfoScreen> {
|
||||
final aboutAllergyController = TextEditingController();
|
||||
final aboutTakingPillsController = TextEditingController();
|
||||
final aboutSportHobbiesController = TextEditingController();
|
||||
final favoriteFoodsController = TextEditingController();
|
||||
final unfavouriteFoodsController = TextEditingController();
|
||||
final additionalInfoController = TextEditingController();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
aboutAllergyController.text = widget.profileDetailsModel.aboutAlergy;
|
||||
aboutTakingPillsController.text = widget.profileDetailsModel.aboutTakingPils;
|
||||
aboutSportHobbiesController.text = widget.profileDetailsModel.aboutSportHobbies;
|
||||
favoriteFoodsController.text = widget.profileDetailsModel.favoriteFoods;
|
||||
unfavouriteFoodsController.text = widget.profileDetailsModel.unfavoriteFoods;
|
||||
additionalInfoController.text = widget.profileDetailsModel.additionalInfo;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final s = S.of(context);
|
||||
@@ -35,6 +53,7 @@ class _OtherInfoScreenState extends State<OtherInfoScreen> {
|
||||
Text(s.allergies_presence),
|
||||
SizedBox(height: 4),
|
||||
CustomTextFormField(
|
||||
controller: aboutAllergyController,
|
||||
hintText: 'Например: орехи, мёд и т.д.',
|
||||
autofocus: true,
|
||||
minLines: 2,
|
||||
@@ -45,6 +64,7 @@ class _OtherInfoScreenState extends State<OtherInfoScreen> {
|
||||
Text(s.do_you_take_pills),
|
||||
SizedBox(height: 4),
|
||||
CustomTextFormField(
|
||||
controller: aboutTakingPillsController,
|
||||
hintText: s.enter_information,
|
||||
autofocus: true,
|
||||
minLines: 2,
|
||||
@@ -55,6 +75,7 @@ class _OtherInfoScreenState extends State<OtherInfoScreen> {
|
||||
Text(s.your_favorite_sports),
|
||||
SizedBox(height: 4),
|
||||
CustomTextFormField(
|
||||
controller: aboutSportHobbiesController,
|
||||
hintText:
|
||||
"Я занимаюсь плаванием , почти каждый вечер прогулки на свежем воздухе, пару раз в месяц играю в волейбол. Стараюсь не сидеть на месте!",
|
||||
autofocus: true,
|
||||
@@ -65,6 +86,7 @@ class _OtherInfoScreenState extends State<OtherInfoScreen> {
|
||||
Text(s.favorite_foods),
|
||||
SizedBox(height: 4),
|
||||
CustomTextFormField(
|
||||
controller: favoriteFoodsController,
|
||||
hintText: s.enter_information,
|
||||
maxLines: 7,
|
||||
minLines: 2,
|
||||
@@ -74,6 +96,7 @@ class _OtherInfoScreenState extends State<OtherInfoScreen> {
|
||||
Text(s.unfavorite_foods),
|
||||
SizedBox(height: 4),
|
||||
CustomTextFormField(
|
||||
controller: unfavouriteFoodsController,
|
||||
hintText: s.enter_information,
|
||||
maxLines: 7,
|
||||
minLines: 2,
|
||||
@@ -88,6 +111,7 @@ class _OtherInfoScreenState extends State<OtherInfoScreen> {
|
||||
),
|
||||
SizedBox(height: 4),
|
||||
CustomTextFormField(
|
||||
controller: additionalInfoController,
|
||||
hintText: "У меня крепкое здоровье, но последнее время часто утомляюсь, однако, это мне не мешает радоваться жизни",
|
||||
maxLines: 8,
|
||||
onChanged: (newValue) {},
|
||||
@@ -104,7 +128,7 @@ class _OtherInfoScreenState extends State<OtherInfoScreen> {
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
child: Ink(
|
||||
height: 52,
|
||||
width: MediaQuery.of(context).size.width - 16,
|
||||
width: MediaQuery.of(context).size.width - 32,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
color: appTheme.blueA400,
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
import 'package:eatvio_app/features/profile/models/profile_model.dart';
|
||||
import 'package:eatvio_app/features/settings/presentation/bloc/settings_cubit/settings_cubit.dart';
|
||||
import 'package:eatvio_app/features/settings/presentation/bloc/settings_cubit/settings_state.dart';
|
||||
import 'package:eatvio_app/locator_service.dart';
|
||||
import 'package:eatvio_app/theme/theme_helper.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
@@ -15,10 +18,32 @@ class PhysicalActivityScreen extends StatefulWidget {
|
||||
State<PhysicalActivityScreen> createState() => _PhysicalActivityScreenState();
|
||||
}
|
||||
|
||||
enum PhysicalActivity { minimum, low, medium, high, extreme, hardWork }
|
||||
enum PhysicalActivity { minimum, low, medium, high, extreme }
|
||||
|
||||
class _PhysicalActivityScreenState extends State<PhysicalActivityScreen> {
|
||||
PhysicalActivity? _physicalActivity = PhysicalActivity.minimum;
|
||||
late PhysicalActivity? _physicalActivity;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
switch (widget.profileDetailsModel.activityCoefficient) {
|
||||
case 1.2:
|
||||
_physicalActivity = PhysicalActivity.minimum;
|
||||
break;
|
||||
case 1.375:
|
||||
_physicalActivity = PhysicalActivity.low;
|
||||
break;
|
||||
case 1.55:
|
||||
_physicalActivity = PhysicalActivity.medium;
|
||||
break;
|
||||
case 1.7:
|
||||
_physicalActivity = PhysicalActivity.high;
|
||||
break;
|
||||
case 1.9:
|
||||
_physicalActivity = PhysicalActivity.extreme;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -87,17 +112,6 @@ class _PhysicalActivityScreenState extends State<PhysicalActivityScreen> {
|
||||
});
|
||||
},
|
||||
),
|
||||
RadioListTile<PhysicalActivity>(
|
||||
contentPadding: EdgeInsets.zero,
|
||||
title: const Text('1,9 6–7 раз в неделю; очень трудоёмкая работа).'),
|
||||
value: PhysicalActivity.hardWork,
|
||||
groupValue: _physicalActivity,
|
||||
onChanged: (PhysicalActivity? value) {
|
||||
setState(() {
|
||||
_physicalActivity = value;
|
||||
});
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -106,7 +120,34 @@ class _PhysicalActivityScreenState extends State<PhysicalActivityScreen> {
|
||||
|
||||
_saveButton() {
|
||||
return InkWell(
|
||||
onTap: () => GoRouter.of(context).pop(),
|
||||
onTap: () {
|
||||
late final double activityCoefficient;
|
||||
switch (_physicalActivity) {
|
||||
case PhysicalActivity.minimum:
|
||||
activityCoefficient = 1.2;
|
||||
break;
|
||||
case PhysicalActivity.low:
|
||||
activityCoefficient = 1.375;
|
||||
break;
|
||||
case PhysicalActivity.medium:
|
||||
activityCoefficient = 1.55;
|
||||
break;
|
||||
case PhysicalActivity.high:
|
||||
activityCoefficient = 1.7;
|
||||
break;
|
||||
case PhysicalActivity.extreme:
|
||||
activityCoefficient = 1.9;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
sl<SettingsCubit>().updateProfileDetails(
|
||||
profileDetailsModel: (sl<SettingsCubit>().state as SettingsStateLoaded).profileDetails.copyWith(
|
||||
activityCoefficient: activityCoefficient,
|
||||
),
|
||||
);
|
||||
GoRouter.of(context).pop();
|
||||
},
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
child: Ink(
|
||||
height: 52,
|
||||
|
||||
@@ -23,6 +23,16 @@ class _PhysicalFormScreenState extends State<PhysicalFormScreen> {
|
||||
final chestCircumferenceController = TextEditingController();
|
||||
final waistCircumferenceController = TextEditingController();
|
||||
final hipCircumferenceController = TextEditingController();
|
||||
final heightController = TextEditingController();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
chestCircumferenceController.text = widget.profileDetailsModel.chestCircumference.toString();
|
||||
waistCircumferenceController.text = widget.profileDetailsModel.waistCircumference.toString();
|
||||
hipCircumferenceController.text = widget.profileDetailsModel.hipCircumference.toString();
|
||||
heightController.text = widget.profileDetailsModel.height.toString();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -44,7 +54,7 @@ class _PhysicalFormScreenState extends State<PhysicalFormScreen> {
|
||||
CustomTextFormField(
|
||||
inputFormatters: [digitsOnly],
|
||||
controller: chestCircumferenceController,
|
||||
hintText: '90',
|
||||
hintText: 'см',
|
||||
),
|
||||
SizedBox(height: 16),
|
||||
Text(s.waist_circumference),
|
||||
@@ -52,7 +62,7 @@ class _PhysicalFormScreenState extends State<PhysicalFormScreen> {
|
||||
CustomTextFormField(
|
||||
inputFormatters: [digitsOnly],
|
||||
controller: waistCircumferenceController,
|
||||
hintText: "60",
|
||||
hintText: 'см',
|
||||
),
|
||||
SizedBox(height: 16),
|
||||
Text(s.hip_circumference),
|
||||
@@ -60,7 +70,16 @@ class _PhysicalFormScreenState extends State<PhysicalFormScreen> {
|
||||
CustomTextFormField(
|
||||
inputFormatters: [digitsOnly],
|
||||
controller: hipCircumferenceController,
|
||||
hintText: '90',
|
||||
hintText: 'см',
|
||||
textInputAction: TextInputAction.done,
|
||||
),
|
||||
SizedBox(height: 16),
|
||||
Text('Рост'),
|
||||
SizedBox(height: 4),
|
||||
CustomTextFormField(
|
||||
inputFormatters: [digitsOnly],
|
||||
controller: heightController,
|
||||
hintText: 'см',
|
||||
textInputAction: TextInputAction.done,
|
||||
),
|
||||
],
|
||||
|
||||
@@ -22,9 +22,20 @@ class PressureScreen extends StatefulWidget {
|
||||
|
||||
class _PressureScreenState extends State<PressureScreen> {
|
||||
final digitsOnly = FilteringTextInputFormatter.digitsOnly;
|
||||
final chestCircumferenceController = TextEditingController();
|
||||
final waistCircumferenceController = TextEditingController();
|
||||
final hipCircumferenceController = TextEditingController();
|
||||
final bloodPressureUpController = TextEditingController();
|
||||
final bloodPressureDownController = TextEditingController();
|
||||
late SelectionPopupModel hypo;
|
||||
late SelectionPopupModel hyper;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
bloodPressureUpController.text = widget.profileDetailsModel.bloodPressureUp.toString();
|
||||
bloodPressureDownController.text = widget.profileDetailsModel.bloodPressureDown.toString();
|
||||
hypo = widget.profileDetailsModel.hasHypo ? selectionPopupList[0] : selectionPopupList[1];
|
||||
hyper = widget.profileDetailsModel.hasHyper ? selectionPopupList[0] : selectionPopupList[1];
|
||||
}
|
||||
|
||||
final List<SelectionPopupModel> selectionPopupList = [
|
||||
SelectionPopupModel(
|
||||
id: 1,
|
||||
@@ -54,6 +65,7 @@ class _PressureScreenState extends State<PressureScreen> {
|
||||
Text(s.up_pressure),
|
||||
SizedBox(height: 4),
|
||||
CustomTextFormField(
|
||||
controller: bloodPressureUpController,
|
||||
inputFormatters: [digitsOnly],
|
||||
hintText: "90",
|
||||
onChanged: (newValue) {},
|
||||
@@ -62,6 +74,7 @@ class _PressureScreenState extends State<PressureScreen> {
|
||||
Text(s.down_pressure),
|
||||
SizedBox(height: 4),
|
||||
CustomTextFormField(
|
||||
controller: bloodPressureDownController,
|
||||
inputFormatters: [digitsOnly],
|
||||
hintText: '90',
|
||||
onChanged: (newValue) {},
|
||||
@@ -71,10 +84,12 @@ class _PressureScreenState extends State<PressureScreen> {
|
||||
SizedBox(height: 4),
|
||||
CustomDropDown(
|
||||
items: selectionPopupList,
|
||||
value: selectionPopupList[0],
|
||||
value: hypo,
|
||||
hintText: "Не выбрано",
|
||||
onChanged: (newPopup) {
|
||||
setState(() {});
|
||||
setState(() {
|
||||
hypo = newPopup;
|
||||
});
|
||||
},
|
||||
),
|
||||
SizedBox(height: 16),
|
||||
@@ -82,10 +97,12 @@ class _PressureScreenState extends State<PressureScreen> {
|
||||
SizedBox(height: 4),
|
||||
CustomDropDown(
|
||||
items: selectionPopupList,
|
||||
value: selectionPopupList[0],
|
||||
value: hyper,
|
||||
hintText: "Не выбрано",
|
||||
onChanged: (newPopup) {
|
||||
setState(() {});
|
||||
setState(() {
|
||||
hyper = newPopup;
|
||||
});
|
||||
},
|
||||
),
|
||||
],
|
||||
|
||||
@@ -7,6 +7,7 @@ import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:rive/rive.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
class SettingsScreen extends StatefulWidget {
|
||||
@@ -17,63 +18,70 @@ class SettingsScreen extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _SettingsScreenState extends State<SettingsScreen> {
|
||||
final SettingsCubit settingsCubit = sl<SettingsCubit>()..init();
|
||||
late bool updatesNotificationsSwitchState;
|
||||
late bool fillDiaryNotificationsSwitchState;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocConsumer<SettingsCubit, SettingsState>(
|
||||
bloc: settingsCubit,
|
||||
listener: (BuildContext context, SettingsState state) {
|
||||
if (state is SettingsStateLoaded) {
|
||||
updatesNotificationsSwitchState = state.profileSettings.newUpdatesNotifications == 1 ? true : false;
|
||||
fillDiaryNotificationsSwitchState = state.profileSettings.diaryReminderNotifications == 1 ? true : false;
|
||||
}
|
||||
},
|
||||
builder: (BuildContext context, SettingsState state) {
|
||||
if (state is SettingsStateLoaded) {
|
||||
return BlocProvider<SettingsCubit>(
|
||||
create: (BuildContext context) => sl<SettingsCubit>()..init(),
|
||||
child: BlocConsumer<SettingsCubit, SettingsState>(
|
||||
listener: (BuildContext context, SettingsState state) {
|
||||
if (state is SettingsStateLoaded) {
|
||||
updatesNotificationsSwitchState = state.profileSettings.newUpdatesNotifications == 1 ? true : false;
|
||||
fillDiaryNotificationsSwitchState = state.profileSettings.diaryReminderNotifications == 1 ? true : false;
|
||||
}
|
||||
},
|
||||
builder: (BuildContext context, SettingsState state) {
|
||||
if (state is SettingsStateLoaded) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text('Настройки'),
|
||||
),
|
||||
body: SingleChildScrollView(
|
||||
padding: EdgeInsets.symmetric(vertical: 16),
|
||||
physics: const BouncingScrollPhysics(),
|
||||
child: Column(
|
||||
children: [
|
||||
_additionalInfo(state),
|
||||
const SizedBox(height: 12),
|
||||
_notifications(state),
|
||||
const SizedBox(height: 12),
|
||||
_aboutEatvio(state),
|
||||
const SizedBox(height: 12),
|
||||
_becomeConsultantButton(state),
|
||||
const SizedBox(height: 8),
|
||||
_deleteAccountButton(state),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
if (state is SettingsStateError) {
|
||||
return Scaffold(
|
||||
body: Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Center(child: Text(state.errorMessage)),
|
||||
),
|
||||
);
|
||||
}
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text('Настройки'),
|
||||
),
|
||||
body: SingleChildScrollView(
|
||||
padding: EdgeInsets.symmetric(vertical: 16),
|
||||
physics: const BouncingScrollPhysics(),
|
||||
child: Column(
|
||||
children: [
|
||||
_additionalInfo(),
|
||||
const SizedBox(height: 12),
|
||||
_notifications(),
|
||||
const SizedBox(height: 12),
|
||||
_aboutEatvio(),
|
||||
const SizedBox(height: 12),
|
||||
_becomeConsultantButton(),
|
||||
const SizedBox(height: 8),
|
||||
_deleteAccountButton(),
|
||||
],
|
||||
body: Center(
|
||||
child: SizedBox(
|
||||
height: 32,
|
||||
width: 32,
|
||||
child: RiveAnimation.asset(
|
||||
'assets/rive_animations/loading.riv',
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
if (state is SettingsStateError) {
|
||||
return Scaffold(
|
||||
body: Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Center(child: Text(state.errorMessage)),
|
||||
),
|
||||
);
|
||||
}
|
||||
return Scaffold(
|
||||
body: Center(
|
||||
child: CircularProgressIndicator(),
|
||||
),
|
||||
);
|
||||
},
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
_additionalInfo() {
|
||||
_additionalInfo(SettingsStateLoaded state) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
@@ -92,7 +100,10 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
||||
_tile(
|
||||
onTap: () => GoRouter.of(context).pushNamed(
|
||||
'generalInfoScreen',
|
||||
extra: (settingsCubit.state as SettingsStateLoaded).profileDetails,
|
||||
extra: state.profileDetails,
|
||||
pathParameters: {
|
||||
'isPublicProfile': state.profileSettings.isPublicProfile.toString(),
|
||||
},
|
||||
),
|
||||
title: 'Общая информация',
|
||||
),
|
||||
@@ -100,7 +111,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
||||
_tile(
|
||||
onTap: () => GoRouter.of(context).pushNamed(
|
||||
'physicalFormScreen',
|
||||
extra: (settingsCubit.state as SettingsStateLoaded).profileDetails,
|
||||
extra: state.profileDetails,
|
||||
),
|
||||
title: 'Физическая форма',
|
||||
),
|
||||
@@ -108,7 +119,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
||||
_tile(
|
||||
onTap: () => GoRouter.of(context).pushNamed(
|
||||
'pressureScreen',
|
||||
extra: (settingsCubit.state as SettingsStateLoaded).profileDetails,
|
||||
extra: state.profileDetails,
|
||||
),
|
||||
title: 'Давление',
|
||||
),
|
||||
@@ -116,7 +127,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
||||
_tile(
|
||||
onTap: () => GoRouter.of(context).pushNamed(
|
||||
'otherInfoScreen',
|
||||
extra: (settingsCubit.state as SettingsStateLoaded).profileDetails,
|
||||
extra: state.profileDetails,
|
||||
),
|
||||
title: 'Прочая информация',
|
||||
),
|
||||
@@ -124,7 +135,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
||||
_tile(
|
||||
onTap: () => GoRouter.of(context).pushNamed(
|
||||
'physicalActivityScreen',
|
||||
extra: (settingsCubit.state as SettingsStateLoaded).profileDetails,
|
||||
extra: state.profileDetails,
|
||||
),
|
||||
title: 'Физическая нагрузка',
|
||||
),
|
||||
@@ -132,7 +143,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
||||
);
|
||||
}
|
||||
|
||||
_notifications() {
|
||||
_notifications(SettingsStateLoaded state) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
@@ -152,8 +163,8 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
||||
setState(() {
|
||||
updatesNotificationsSwitchState = !updatesNotificationsSwitchState;
|
||||
});
|
||||
settingsCubit.updateProfileSettings(
|
||||
profileSettingsModel: (settingsCubit.state as SettingsStateLoaded).profileSettings.copyWith(
|
||||
context.read<SettingsCubit>().updateProfileSettings(
|
||||
profileSettingsModel: state.profileSettings.copyWith(
|
||||
newUpdatesNotifications: updatesNotificationsSwitchState,
|
||||
),
|
||||
);
|
||||
@@ -166,8 +177,8 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
||||
setState(() {
|
||||
updatesNotificationsSwitchState = newValue;
|
||||
});
|
||||
settingsCubit.updateProfileSettings(
|
||||
profileSettingsModel: (settingsCubit.state as SettingsStateLoaded).profileSettings.copyWith(
|
||||
context.read<SettingsCubit>().updateProfileSettings(
|
||||
profileSettingsModel: state.profileSettings.copyWith(
|
||||
newUpdatesNotifications: updatesNotificationsSwitchState,
|
||||
),
|
||||
);
|
||||
@@ -180,8 +191,8 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
||||
setState(() {
|
||||
fillDiaryNotificationsSwitchState = !fillDiaryNotificationsSwitchState;
|
||||
});
|
||||
settingsCubit.updateProfileSettings(
|
||||
profileSettingsModel: (settingsCubit.state as SettingsStateLoaded).profileSettings.copyWith(
|
||||
context.read<SettingsCubit>().updateProfileSettings(
|
||||
profileSettingsModel: state.profileSettings.copyWith(
|
||||
diaryReminderNotifications: fillDiaryNotificationsSwitchState,
|
||||
),
|
||||
);
|
||||
@@ -194,8 +205,8 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
||||
setState(() {
|
||||
fillDiaryNotificationsSwitchState = newValue;
|
||||
});
|
||||
settingsCubit.updateProfileSettings(
|
||||
profileSettingsModel: (settingsCubit.state as SettingsStateLoaded).profileSettings.copyWith(
|
||||
context.read<SettingsCubit>().updateProfileSettings(
|
||||
profileSettingsModel: state.profileSettings.copyWith(
|
||||
diaryReminderNotifications: fillDiaryNotificationsSwitchState,
|
||||
),
|
||||
);
|
||||
@@ -206,7 +217,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
||||
);
|
||||
}
|
||||
|
||||
_aboutEatvio() {
|
||||
_aboutEatvio(SettingsStateLoaded state) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
@@ -234,7 +245,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
||||
);
|
||||
}
|
||||
|
||||
_becomeConsultantButton() {
|
||||
_becomeConsultantButton(SettingsStateLoaded state) {
|
||||
return Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 16),
|
||||
child: InkWell(
|
||||
@@ -263,7 +274,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
||||
);
|
||||
}
|
||||
|
||||
_deleteAccountButton() {
|
||||
_deleteAccountButton(SettingsStateLoaded state) {
|
||||
return Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 16),
|
||||
child: InkWell(
|
||||
|
||||
Reference in New Issue
Block a user