forked from eatvio/eatvio_app
feat: settings (data save) + new fields
This commit is contained in:
@@ -17,12 +17,13 @@ import 'package:eatvio_app/features/menu/presentation/pages/menu_screen.dart';
|
|||||||
import 'package:eatvio_app/features/notifications/presentation/pages/notifications_screen.dart';
|
import 'package:eatvio_app/features/notifications/presentation/pages/notifications_screen.dart';
|
||||||
import 'package:eatvio_app/features/plans/models/plan_pagination_model.dart';
|
import 'package:eatvio_app/features/plans/models/plan_pagination_model.dart';
|
||||||
import 'package:eatvio_app/features/plans/presentation/pages/about_plan_screen.dart';
|
import 'package:eatvio_app/features/plans/presentation/pages/about_plan_screen.dart';
|
||||||
import 'package:eatvio_app/features/profile/models/profile_model.dart';
|
|
||||||
import 'package:eatvio_app/features/profile/presentation/pages/profile_screen.dart';
|
import 'package:eatvio_app/features/profile/presentation/pages/profile_screen.dart';
|
||||||
import 'package:eatvio_app/features/recipes/presentation/pages/about_recipes_screen.dart';
|
import 'package:eatvio_app/features/recipes/presentation/pages/about_recipes_screen.dart';
|
||||||
import 'package:eatvio_app/features/recipes/presentation/pages/recipe_create_screen.dart';
|
import 'package:eatvio_app/features/recipes/presentation/pages/recipe_create_screen.dart';
|
||||||
import 'package:eatvio_app/features/recipes/presentation/pages/recipe_edit_screen.dart';
|
import 'package:eatvio_app/features/recipes/presentation/pages/recipe_edit_screen.dart';
|
||||||
import 'package:eatvio_app/features/registration/presentation/pages/registration_screen.dart';
|
import 'package:eatvio_app/features/registration/presentation/pages/registration_screen.dart';
|
||||||
|
import 'package:eatvio_app/features/settings/entities/settings_entity.dart';
|
||||||
|
import 'package:eatvio_app/features/settings/presentation/pages/change_password_screen.dart';
|
||||||
import 'package:eatvio_app/features/settings/presentation/pages/general_info_screen.dart';
|
import 'package:eatvio_app/features/settings/presentation/pages/general_info_screen.dart';
|
||||||
import 'package:eatvio_app/features/settings/presentation/pages/other_info_screen.dart';
|
import 'package:eatvio_app/features/settings/presentation/pages/other_info_screen.dart';
|
||||||
import 'package:eatvio_app/features/settings/presentation/pages/physical_activity_screen.dart';
|
import 'package:eatvio_app/features/settings/presentation/pages/physical_activity_screen.dart';
|
||||||
@@ -172,39 +173,45 @@ class AppRouter {
|
|||||||
builder: (context, state) => SettingsScreen(),
|
builder: (context, state) => SettingsScreen(),
|
||||||
routes: [
|
routes: [
|
||||||
GoRoute(
|
GoRoute(
|
||||||
path: 'general-info-screen/:isPublicProfile',
|
path: 'general-info-screen',
|
||||||
name: 'generalInfoScreen',
|
name: 'generalInfoScreen',
|
||||||
builder: (context, state) => GeneralInfoScreen(
|
builder: (context, state) => GeneralInfoScreen(
|
||||||
profileDetailsModel: state.extra as ProfileDetailsModel,
|
settingsEntity: state.extra as SettingsEntity,
|
||||||
isPublicProfile: bool.parse(state.pathParameters['isPublicProfile']!),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
GoRoute(
|
GoRoute(
|
||||||
path: 'other-info-screen',
|
path: 'other-info-screen',
|
||||||
name: 'otherInfoScreen',
|
name: 'otherInfoScreen',
|
||||||
builder: (context, state) => OtherInfoScreen(
|
builder: (context, state) => OtherInfoScreen(
|
||||||
profileDetailsModel: state.extra as ProfileDetailsModel,
|
settingsEntity: state.extra as SettingsEntity,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
GoRoute(
|
GoRoute(
|
||||||
path: 'physical-activity-screen',
|
path: 'physical-activity-screen',
|
||||||
name: 'physicalActivityScreen',
|
name: 'physicalActivityScreen',
|
||||||
builder: (context, state) => PhysicalActivityScreen(
|
builder: (context, state) => PhysicalActivityScreen(
|
||||||
profileDetailsModel: state.extra as ProfileDetailsModel,
|
settingsEntity: state.extra as SettingsEntity,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
GoRoute(
|
GoRoute(
|
||||||
path: 'physical-form-screen',
|
path: 'physical-form-screen',
|
||||||
name: 'physicalFormScreen',
|
name: 'physicalFormScreen',
|
||||||
builder: (context, state) => PhysicalFormScreen(
|
builder: (context, state) => PhysicalFormScreen(
|
||||||
profileDetailsModel: state.extra as ProfileDetailsModel,
|
settingsEntity: state.extra as SettingsEntity,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
GoRoute(
|
GoRoute(
|
||||||
path: 'pressure-screen',
|
path: 'pressure-screen',
|
||||||
name: 'pressureScreen',
|
name: 'pressureScreen',
|
||||||
builder: (context, state) => PressureScreen(
|
builder: (context, state) => PressureScreen(
|
||||||
profileDetailsModel: state.extra as ProfileDetailsModel,
|
settingsEntity: state.extra as SettingsEntity,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
GoRoute(
|
||||||
|
path: 'change-password-screen',
|
||||||
|
name: 'changePasswordScreen',
|
||||||
|
builder: (context, state) => ChangePasswordScreen(
|
||||||
|
settingsEntity: state.extra as SettingsEntity,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
15
lib/features/settings/entities/settings_entity.dart
Normal file
15
lib/features/settings/entities/settings_entity.dart
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
import 'package:eatvio_app/features/profile/models/profile_model.dart';
|
||||||
|
import 'package:eatvio_app/features/settings/models/profile_settings_model.dart';
|
||||||
|
import 'package:eatvio_app/features/settings/presentation/bloc/settings_cubit/settings_cubit.dart';
|
||||||
|
|
||||||
|
class SettingsEntity {
|
||||||
|
final ProfileSettingsModel profileSettingsModel;
|
||||||
|
final ProfileDetailsModel profileDetailsModel;
|
||||||
|
final SettingsCubit settingsCubit;
|
||||||
|
|
||||||
|
SettingsEntity({
|
||||||
|
required this.profileSettingsModel,
|
||||||
|
required this.profileDetailsModel,
|
||||||
|
required this.settingsCubit,
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -12,9 +12,9 @@ class SettingsCubit extends Cubit<SettingsState> {
|
|||||||
SettingsCubit({
|
SettingsCubit({
|
||||||
required this.profileRepository,
|
required this.profileRepository,
|
||||||
required this.settingsRepository,
|
required this.settingsRepository,
|
||||||
}) : super(SettingsState.loading());
|
}) : super(const SettingsState.loading());
|
||||||
|
|
||||||
init() async {
|
Future<void> init() async {
|
||||||
try {
|
try {
|
||||||
emit(SettingsState.loaded(
|
emit(SettingsState.loaded(
|
||||||
profileSettings: await settingsRepository.getProfileSettings(),
|
profileSettings: await settingsRepository.getProfileSettings(),
|
||||||
@@ -26,7 +26,7 @@ class SettingsCubit extends Cubit<SettingsState> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
updateProfileDetails({
|
updateProfileDetails({
|
||||||
required ProfileDetailsModel profileDetailsModel
|
required ProfileDetailsModel profileDetailsModel,
|
||||||
}) async {
|
}) async {
|
||||||
try {
|
try {
|
||||||
await settingsRepository.updateProfileDetails(
|
await settingsRepository.updateProfileDetails(
|
||||||
@@ -35,11 +35,13 @@ class SettingsCubit extends Cubit<SettingsState> {
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
print(e);
|
print(e);
|
||||||
rethrow;
|
rethrow;
|
||||||
|
} finally {
|
||||||
|
await init();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
updateProfileSettings({
|
updateProfileSettings({
|
||||||
required ProfileSettingsModel profileSettingsModel
|
required ProfileSettingsModel profileSettingsModel,
|
||||||
}) async {
|
}) async {
|
||||||
try {
|
try {
|
||||||
await settingsRepository.updateProfileSettings(
|
await settingsRepository.updateProfileSettings(
|
||||||
@@ -48,6 +50,8 @@ class SettingsCubit extends Cubit<SettingsState> {
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
print(e);
|
print(e);
|
||||||
rethrow;
|
rethrow;
|
||||||
|
} finally {
|
||||||
|
await init();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
import 'package:eatvio_app/features/settings/entities/settings_entity.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class ChangePasswordScreen extends StatefulWidget {
|
||||||
|
final SettingsEntity settingsEntity;
|
||||||
|
|
||||||
|
const ChangePasswordScreen({
|
||||||
|
super.key,
|
||||||
|
required this.settingsEntity,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<ChangePasswordScreen> createState() => _ChangePasswordScreenState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _ChangePasswordScreenState extends State<ChangePasswordScreen> {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
title: Text('Смена пароля'),
|
||||||
|
),
|
||||||
|
body: Center(
|
||||||
|
child: Text('Coming soon...'),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,20 +1,21 @@
|
|||||||
import 'package:eatvio_app/core/utils/date_time_utils.dart';
|
import 'package:eatvio_app/core/utils/date_time_utils.dart';
|
||||||
import 'package:eatvio_app/features/profile/models/profile_model.dart';
|
import 'package:eatvio_app/data/models/selectionPopupModel/selection_popup_model.dart';
|
||||||
|
import 'package:eatvio_app/features/settings/entities/settings_entity.dart';
|
||||||
|
import 'package:eatvio_app/features/settings/presentation/bloc/settings_cubit/settings_state.dart';
|
||||||
import 'package:eatvio_app/generated/l10n.dart';
|
import 'package:eatvio_app/generated/l10n.dart';
|
||||||
import 'package:eatvio_app/theme/theme_helper.dart';
|
import 'package:eatvio_app/theme/theme_helper.dart';
|
||||||
|
import 'package:eatvio_app/widgets/custom_drop_down.dart';
|
||||||
import 'package:eatvio_app/widgets/custom_text_form_field.dart';
|
import 'package:eatvio_app/widgets/custom_text_form_field.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
|
|
||||||
class GeneralInfoScreen extends StatefulWidget {
|
class GeneralInfoScreen extends StatefulWidget {
|
||||||
final ProfileDetailsModel profileDetailsModel;
|
final SettingsEntity settingsEntity;
|
||||||
final bool isPublicProfile;
|
|
||||||
|
|
||||||
const GeneralInfoScreen({
|
const GeneralInfoScreen({
|
||||||
super.key,
|
super.key,
|
||||||
required this.profileDetailsModel,
|
required this.settingsEntity,
|
||||||
required this.isPublicProfile,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -24,25 +25,36 @@ class GeneralInfoScreen extends StatefulWidget {
|
|||||||
class _GeneralInfoScreenState extends State<GeneralInfoScreen> {
|
class _GeneralInfoScreenState extends State<GeneralInfoScreen> {
|
||||||
final firstNameController = TextEditingController();
|
final firstNameController = TextEditingController();
|
||||||
final lastNameController = TextEditingController();
|
final lastNameController = TextEditingController();
|
||||||
final genderController = TextEditingController();
|
late DateTime selectedDate;
|
||||||
|
late SelectionPopupModel gender;
|
||||||
final countryController = TextEditingController();
|
final countryController = TextEditingController();
|
||||||
final cityController = TextEditingController();
|
final cityController = TextEditingController();
|
||||||
final languageController = TextEditingController();
|
final languageController = TextEditingController();
|
||||||
late DateTime selectedDate;
|
late SelectionPopupModel isPublicProfile;
|
||||||
late bool isPublicProfile;
|
|
||||||
|
final List<SelectionPopupModel> genderSelectionPopupList = [
|
||||||
|
SelectionPopupModel(id: 0, title: 'Женский', value: 'female'),
|
||||||
|
SelectionPopupModel(id: 1, title: 'Мужской', value: 'male'),
|
||||||
|
];
|
||||||
|
|
||||||
|
final List<SelectionPopupModel> isPublicProfileSelectionPopupList = [
|
||||||
|
SelectionPopupModel(id: 0, title: 'Только зарегистрированным', value: false),
|
||||||
|
SelectionPopupModel(id: 1, title: 'Всем', value: true),
|
||||||
|
];
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
selectedDate = DateTime.now();
|
selectedDate = DateTime.now();
|
||||||
firstNameController.text = widget.profileDetailsModel.firstName;
|
firstNameController.text = widget.settingsEntity.profileDetailsModel.firstName;
|
||||||
lastNameController.text = widget.profileDetailsModel.lastName;
|
lastNameController.text = widget.settingsEntity.profileDetailsModel.lastName;
|
||||||
selectedDate = DateTime.parse(widget.profileDetailsModel.birthdate);
|
selectedDate = DateTime.parse(widget.settingsEntity.profileDetailsModel.birthdate);
|
||||||
genderController.text = widget.profileDetailsModel.gender;
|
gender = widget.settingsEntity.profileDetailsModel.gender == 'male' ? genderSelectionPopupList[1] : genderSelectionPopupList[0];
|
||||||
countryController.text = widget.profileDetailsModel.country;
|
countryController.text = widget.settingsEntity.profileDetailsModel.country;
|
||||||
cityController.text = widget.profileDetailsModel.city;
|
cityController.text = widget.settingsEntity.profileDetailsModel.city;
|
||||||
languageController.text = widget.profileDetailsModel.lang;
|
languageController.text = widget.settingsEntity.profileDetailsModel.lang;
|
||||||
isPublicProfile = widget.isPublicProfile;
|
isPublicProfile =
|
||||||
|
widget.settingsEntity.profileSettingsModel.isPublicProfile == true ? isPublicProfileSelectionPopupList[1] : isPublicProfileSelectionPopupList[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -78,43 +90,60 @@ class _GeneralInfoScreenState extends State<GeneralInfoScreen> {
|
|||||||
SizedBox(height: 16),
|
SizedBox(height: 16),
|
||||||
Text(s.date_of_birth),
|
Text(s.date_of_birth),
|
||||||
SizedBox(height: 4),
|
SizedBox(height: 4),
|
||||||
CustomTextFormField(
|
ListTile(
|
||||||
initialValue: selectedDate.format('dd MMMM yyyy', 'ru'),
|
onTap: onTapCalendar(context),
|
||||||
|
trailing: Icon(
|
||||||
|
Icons.keyboard_arrow_down_rounded,
|
||||||
|
color: Colors.grey.shade700,
|
||||||
|
),
|
||||||
|
contentPadding: EdgeInsets.symmetric(horizontal: 12),
|
||||||
|
title: Text(selectedDate.format('dd MMMM yyyy', 'ru')),
|
||||||
|
tileColor: Color(0xFFF6F6F6),
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(20),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
SizedBox(height: 16),
|
SizedBox(height: 16),
|
||||||
Text('Пол'),
|
Text('Пол'),
|
||||||
SizedBox(height: 4),
|
SizedBox(height: 4),
|
||||||
CustomTextFormField(
|
CustomDropDown(
|
||||||
controller: genderController,
|
items: genderSelectionPopupList,
|
||||||
onChanged: (newValue) {},
|
value: gender,
|
||||||
|
onChanged: (newValue) {
|
||||||
|
setState(() {
|
||||||
|
gender = newValue;
|
||||||
|
});
|
||||||
|
},
|
||||||
),
|
),
|
||||||
SizedBox(height: 16),
|
SizedBox(height: 16),
|
||||||
Text('Страна'),
|
Text('Страна'),
|
||||||
SizedBox(height: 4),
|
SizedBox(height: 4),
|
||||||
CustomTextFormField(
|
CustomTextFormField(
|
||||||
controller: countryController,
|
controller: countryController,
|
||||||
onChanged: (newValue) {},
|
|
||||||
),
|
),
|
||||||
SizedBox(height: 16),
|
SizedBox(height: 16),
|
||||||
Text('Город'),
|
Text('Город'),
|
||||||
SizedBox(height: 4),
|
SizedBox(height: 4),
|
||||||
CustomTextFormField(
|
CustomTextFormField(
|
||||||
controller: cityController,
|
controller: cityController,
|
||||||
onChanged: (newValue) {},
|
|
||||||
),
|
),
|
||||||
SizedBox(height: 16),
|
SizedBox(height: 16),
|
||||||
Text('Предпочтительный язык общения'),
|
Text('Предпочтительный язык общения'),
|
||||||
SizedBox(height: 4),
|
SizedBox(height: 4),
|
||||||
CustomTextFormField(
|
CustomTextFormField(
|
||||||
controller: languageController,
|
controller: languageController,
|
||||||
onChanged: (newValue) {},
|
|
||||||
),
|
),
|
||||||
SizedBox(height: 16),
|
SizedBox(height: 16),
|
||||||
Text('Показывать анкету'),
|
Text('Показывать анкету'),
|
||||||
SizedBox(height: 4),
|
SizedBox(height: 4),
|
||||||
CustomTextFormField(
|
CustomDropDown(
|
||||||
initialValue: isPublicProfile ? 'Всем' : 'Только зарегистрированным',
|
items: isPublicProfileSelectionPopupList,
|
||||||
onChanged: (newValue) {},
|
value: isPublicProfile,
|
||||||
|
onChanged: (newValue) {
|
||||||
|
setState(() {
|
||||||
|
isPublicProfile = newValue;
|
||||||
|
});
|
||||||
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -133,8 +162,6 @@ class _GeneralInfoScreenState extends State<GeneralInfoScreen> {
|
|||||||
onDateTimeChanged: (DateTime newDateTime) {
|
onDateTimeChanged: (DateTime newDateTime) {
|
||||||
setState(() {
|
setState(() {
|
||||||
selectedDate = newDateTime;
|
selectedDate = newDateTime;
|
||||||
// final registrationCubit = context.read<RegistrationCubit>();
|
|
||||||
// registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(birthdate: selectedDate.toString()));
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@@ -162,7 +189,25 @@ class _GeneralInfoScreenState extends State<GeneralInfoScreen> {
|
|||||||
|
|
||||||
_saveButton() {
|
_saveButton() {
|
||||||
return InkWell(
|
return InkWell(
|
||||||
onTap: () => GoRouter.of(context).pop(),
|
onTap: () {
|
||||||
|
widget.settingsEntity.settingsCubit.updateProfileDetails(
|
||||||
|
profileDetailsModel: (widget.settingsEntity.settingsCubit.state as SettingsStateLoaded).profileDetails.copyWith(
|
||||||
|
firstName: firstNameController.text,
|
||||||
|
lastName: lastNameController.text,
|
||||||
|
birthdate: selectedDate.toString(),
|
||||||
|
gender: gender.value,
|
||||||
|
country: countryController.text,
|
||||||
|
city: cityController.text,
|
||||||
|
lang: languageController.text,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
widget.settingsEntity.settingsCubit.updateProfileSettings(
|
||||||
|
profileSettingsModel: (widget.settingsEntity.settingsCubit.state as SettingsStateLoaded).profileSettings.copyWith(
|
||||||
|
isPublicProfile: isPublicProfile.value,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
GoRouter.of(context).pop();
|
||||||
|
},
|
||||||
borderRadius: BorderRadius.circular(20),
|
borderRadius: BorderRadius.circular(20),
|
||||||
child: Ink(
|
child: Ink(
|
||||||
height: 52,
|
height: 52,
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import 'package:eatvio_app/features/profile/models/profile_model.dart';
|
import 'package:eatvio_app/features/settings/entities/settings_entity.dart';
|
||||||
|
import 'package:eatvio_app/features/settings/presentation/bloc/settings_cubit/settings_state.dart';
|
||||||
import 'package:eatvio_app/generated/l10n.dart';
|
import 'package:eatvio_app/generated/l10n.dart';
|
||||||
import 'package:eatvio_app/theme/theme_helper.dart';
|
import 'package:eatvio_app/theme/theme_helper.dart';
|
||||||
import 'package:eatvio_app/widgets/custom_text_form_field.dart';
|
import 'package:eatvio_app/widgets/custom_text_form_field.dart';
|
||||||
@@ -6,11 +7,11 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
|
|
||||||
class OtherInfoScreen extends StatefulWidget {
|
class OtherInfoScreen extends StatefulWidget {
|
||||||
final ProfileDetailsModel profileDetailsModel;
|
final SettingsEntity settingsEntity;
|
||||||
|
|
||||||
const OtherInfoScreen({
|
const OtherInfoScreen({
|
||||||
super.key,
|
super.key,
|
||||||
required this.profileDetailsModel,
|
required this.settingsEntity,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -22,18 +23,18 @@ class _OtherInfoScreenState extends State<OtherInfoScreen> {
|
|||||||
final aboutTakingPillsController = TextEditingController();
|
final aboutTakingPillsController = TextEditingController();
|
||||||
final aboutSportHobbiesController = TextEditingController();
|
final aboutSportHobbiesController = TextEditingController();
|
||||||
final favoriteFoodsController = TextEditingController();
|
final favoriteFoodsController = TextEditingController();
|
||||||
final unfavouriteFoodsController = TextEditingController();
|
final unFavouriteFoodsController = TextEditingController();
|
||||||
final additionalInfoController = TextEditingController();
|
final additionalInfoController = TextEditingController();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
aboutAllergyController.text = widget.profileDetailsModel.aboutAlergy;
|
aboutAllergyController.text = widget.settingsEntity.profileDetailsModel.aboutAlergy;
|
||||||
aboutTakingPillsController.text = widget.profileDetailsModel.aboutTakingPils;
|
aboutTakingPillsController.text = widget.settingsEntity.profileDetailsModel.aboutTakingPils;
|
||||||
aboutSportHobbiesController.text = widget.profileDetailsModel.aboutSportHobbies;
|
aboutSportHobbiesController.text = widget.settingsEntity.profileDetailsModel.aboutSportHobbies;
|
||||||
favoriteFoodsController.text = widget.profileDetailsModel.favoriteFoods;
|
favoriteFoodsController.text = widget.settingsEntity.profileDetailsModel.favoriteFoods;
|
||||||
unfavouriteFoodsController.text = widget.profileDetailsModel.unfavoriteFoods;
|
unFavouriteFoodsController.text = widget.settingsEntity.profileDetailsModel.unfavoriteFoods;
|
||||||
additionalInfoController.text = widget.profileDetailsModel.additionalInfo;
|
additionalInfoController.text = widget.settingsEntity.profileDetailsModel.additionalInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -96,7 +97,7 @@ class _OtherInfoScreenState extends State<OtherInfoScreen> {
|
|||||||
Text(s.unfavorite_foods),
|
Text(s.unfavorite_foods),
|
||||||
SizedBox(height: 4),
|
SizedBox(height: 4),
|
||||||
CustomTextFormField(
|
CustomTextFormField(
|
||||||
controller: unfavouriteFoodsController,
|
controller: unFavouriteFoodsController,
|
||||||
hintText: s.enter_information,
|
hintText: s.enter_information,
|
||||||
maxLines: 7,
|
maxLines: 7,
|
||||||
minLines: 2,
|
minLines: 2,
|
||||||
@@ -124,7 +125,19 @@ class _OtherInfoScreenState extends State<OtherInfoScreen> {
|
|||||||
|
|
||||||
_saveButton() {
|
_saveButton() {
|
||||||
return InkWell(
|
return InkWell(
|
||||||
onTap: () => GoRouter.of(context).pop(),
|
onTap: () {
|
||||||
|
widget.settingsEntity.settingsCubit.updateProfileDetails(
|
||||||
|
profileDetailsModel: (widget.settingsEntity.settingsCubit.state as SettingsStateLoaded).profileDetails.copyWith(
|
||||||
|
aboutAlergy: aboutAllergyController.text,
|
||||||
|
aboutTakingPils: aboutTakingPillsController.text,
|
||||||
|
aboutSportHobbies: aboutSportHobbiesController.text,
|
||||||
|
favoriteFoods: favoriteFoodsController.text,
|
||||||
|
unfavoriteFoods: unFavouriteFoodsController.text,
|
||||||
|
additionalInfo: additionalInfoController.text,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
GoRouter.of(context).pop();
|
||||||
|
},
|
||||||
borderRadius: BorderRadius.circular(20),
|
borderRadius: BorderRadius.circular(20),
|
||||||
child: Ink(
|
child: Ink(
|
||||||
height: 52,
|
height: 52,
|
||||||
|
|||||||
@@ -1,17 +1,15 @@
|
|||||||
import 'package:eatvio_app/features/profile/models/profile_model.dart';
|
import 'package:eatvio_app/features/settings/entities/settings_entity.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/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:eatvio_app/theme/theme_helper.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
|
|
||||||
class PhysicalActivityScreen extends StatefulWidget {
|
class PhysicalActivityScreen extends StatefulWidget {
|
||||||
final ProfileDetailsModel profileDetailsModel;
|
final SettingsEntity settingsEntity;
|
||||||
|
|
||||||
const PhysicalActivityScreen({
|
const PhysicalActivityScreen({
|
||||||
super.key,
|
super.key,
|
||||||
required this.profileDetailsModel,
|
required this.settingsEntity,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -26,7 +24,7 @@ class _PhysicalActivityScreenState extends State<PhysicalActivityScreen> {
|
|||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
switch (widget.profileDetailsModel.activityCoefficient) {
|
switch (widget.settingsEntity.profileDetailsModel.activityCoefficient) {
|
||||||
case 1.2:
|
case 1.2:
|
||||||
_physicalActivity = PhysicalActivity.minimum;
|
_physicalActivity = PhysicalActivity.minimum;
|
||||||
break;
|
break;
|
||||||
@@ -141,11 +139,11 @@ class _PhysicalActivityScreenState extends State<PhysicalActivityScreen> {
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
sl<SettingsCubit>().updateProfileDetails(
|
widget.settingsEntity.settingsCubit.updateProfileDetails(
|
||||||
profileDetailsModel: (sl<SettingsCubit>().state as SettingsStateLoaded).profileDetails.copyWith(
|
profileDetailsModel: (widget.settingsEntity.settingsCubit.state as SettingsStateLoaded).profileDetails.copyWith(
|
||||||
activityCoefficient: activityCoefficient,
|
activityCoefficient: activityCoefficient,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
GoRouter.of(context).pop();
|
GoRouter.of(context).pop();
|
||||||
},
|
},
|
||||||
borderRadius: BorderRadius.circular(20),
|
borderRadius: BorderRadius.circular(20),
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import 'package:eatvio_app/features/profile/models/profile_model.dart';
|
import 'package:eatvio_app/features/settings/entities/settings_entity.dart';
|
||||||
|
import 'package:eatvio_app/features/settings/presentation/bloc/settings_cubit/settings_state.dart';
|
||||||
import 'package:eatvio_app/generated/l10n.dart';
|
import 'package:eatvio_app/generated/l10n.dart';
|
||||||
import 'package:eatvio_app/theme/theme_helper.dart';
|
import 'package:eatvio_app/theme/theme_helper.dart';
|
||||||
import 'package:eatvio_app/widgets/custom_text_form_field.dart';
|
import 'package:eatvio_app/widgets/custom_text_form_field.dart';
|
||||||
@@ -7,11 +8,11 @@ import 'package:flutter/services.dart';
|
|||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
|
|
||||||
class PhysicalFormScreen extends StatefulWidget {
|
class PhysicalFormScreen extends StatefulWidget {
|
||||||
final ProfileDetailsModel profileDetailsModel;
|
final SettingsEntity settingsEntity;
|
||||||
|
|
||||||
const PhysicalFormScreen({
|
const PhysicalFormScreen({
|
||||||
super.key,
|
super.key,
|
||||||
required this.profileDetailsModel,
|
required this.settingsEntity,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -28,10 +29,10 @@ class _PhysicalFormScreenState extends State<PhysicalFormScreen> {
|
|||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
chestCircumferenceController.text = widget.profileDetailsModel.chestCircumference.toString();
|
chestCircumferenceController.text = widget.settingsEntity.profileDetailsModel.chestCircumference.toString();
|
||||||
waistCircumferenceController.text = widget.profileDetailsModel.waistCircumference.toString();
|
waistCircumferenceController.text = widget.settingsEntity.profileDetailsModel.waistCircumference.toString();
|
||||||
hipCircumferenceController.text = widget.profileDetailsModel.hipCircumference.toString();
|
hipCircumferenceController.text = widget.settingsEntity.profileDetailsModel.hipCircumference.toString();
|
||||||
heightController.text = widget.profileDetailsModel.height.toString();
|
heightController.text = widget.settingsEntity.profileDetailsModel.height.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -90,7 +91,17 @@ class _PhysicalFormScreenState extends State<PhysicalFormScreen> {
|
|||||||
|
|
||||||
_saveButton() {
|
_saveButton() {
|
||||||
return InkWell(
|
return InkWell(
|
||||||
onTap: () => GoRouter.of(context).pop(),
|
onTap: () {
|
||||||
|
widget.settingsEntity.settingsCubit.updateProfileDetails(
|
||||||
|
profileDetailsModel: (widget.settingsEntity.settingsCubit.state as SettingsStateLoaded).profileDetails.copyWith(
|
||||||
|
chestCircumference: int.parse(chestCircumferenceController.text),
|
||||||
|
waistCircumference: int.parse(waistCircumferenceController.text),
|
||||||
|
hipCircumference: int.parse(hipCircumferenceController.text),
|
||||||
|
height: int.parse(heightController.text),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
GoRouter.of(context).pop();
|
||||||
|
},
|
||||||
borderRadius: BorderRadius.circular(20),
|
borderRadius: BorderRadius.circular(20),
|
||||||
child: Ink(
|
child: Ink(
|
||||||
height: 52,
|
height: 52,
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import 'package:eatvio_app/data/models/selectionPopupModel/selection_popup_model.dart';
|
import 'package:eatvio_app/data/models/selectionPopupModel/selection_popup_model.dart';
|
||||||
import 'package:eatvio_app/features/profile/models/profile_model.dart';
|
import 'package:eatvio_app/features/settings/entities/settings_entity.dart';
|
||||||
|
import 'package:eatvio_app/features/settings/presentation/bloc/settings_cubit/settings_state.dart';
|
||||||
import 'package:eatvio_app/generated/l10n.dart';
|
import 'package:eatvio_app/generated/l10n.dart';
|
||||||
import 'package:eatvio_app/theme/theme_helper.dart';
|
import 'package:eatvio_app/theme/theme_helper.dart';
|
||||||
import 'package:eatvio_app/widgets/custom_drop_down.dart';
|
import 'package:eatvio_app/widgets/custom_drop_down.dart';
|
||||||
@@ -9,11 +10,11 @@ import 'package:flutter/services.dart';
|
|||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
|
|
||||||
class PressureScreen extends StatefulWidget {
|
class PressureScreen extends StatefulWidget {
|
||||||
final ProfileDetailsModel profileDetailsModel;
|
final SettingsEntity settingsEntity;
|
||||||
|
|
||||||
const PressureScreen({
|
const PressureScreen({
|
||||||
super.key,
|
super.key,
|
||||||
required this.profileDetailsModel,
|
required this.settingsEntity,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -30,21 +31,15 @@ class _PressureScreenState extends State<PressureScreen> {
|
|||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
bloodPressureUpController.text = widget.profileDetailsModel.bloodPressureUp.toString();
|
bloodPressureUpController.text = widget.settingsEntity.profileDetailsModel.bloodPressureUp.toString();
|
||||||
bloodPressureDownController.text = widget.profileDetailsModel.bloodPressureDown.toString();
|
bloodPressureDownController.text = widget.settingsEntity.profileDetailsModel.bloodPressureDown.toString();
|
||||||
hypo = widget.profileDetailsModel.hasHypo ? selectionPopupList[0] : selectionPopupList[1];
|
hypo = widget.settingsEntity.profileDetailsModel.hasHypo ? selectionPopupList[1] : selectionPopupList[0];
|
||||||
hyper = widget.profileDetailsModel.hasHyper ? selectionPopupList[0] : selectionPopupList[1];
|
hyper = widget.settingsEntity.profileDetailsModel.hasHyper ? selectionPopupList[1] : selectionPopupList[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
final List<SelectionPopupModel> selectionPopupList = [
|
final List<SelectionPopupModel> selectionPopupList = [
|
||||||
SelectionPopupModel(
|
SelectionPopupModel(id: 0, title: 'Нет', value: false),
|
||||||
id: 1,
|
SelectionPopupModel(id: 1, title: 'Да', value: true),
|
||||||
title: "Да",
|
|
||||||
),
|
|
||||||
SelectionPopupModel(
|
|
||||||
id: 0,
|
|
||||||
title: "Нет",
|
|
||||||
),
|
|
||||||
];
|
];
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -113,7 +108,17 @@ class _PressureScreenState extends State<PressureScreen> {
|
|||||||
|
|
||||||
_saveButton() {
|
_saveButton() {
|
||||||
return InkWell(
|
return InkWell(
|
||||||
onTap: () => GoRouter.of(context).pop(),
|
onTap: () {
|
||||||
|
widget.settingsEntity.settingsCubit.updateProfileDetails(
|
||||||
|
profileDetailsModel: (widget.settingsEntity.settingsCubit.state as SettingsStateLoaded).profileDetails.copyWith(
|
||||||
|
bloodPressureUp: int.parse(bloodPressureUpController.text),
|
||||||
|
bloodPressureDown: int.parse(bloodPressureDownController.text),
|
||||||
|
hasHyper: hyper.value,
|
||||||
|
hasHypo: hypo.value,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
GoRouter.of(context).pop();
|
||||||
|
},
|
||||||
borderRadius: BorderRadius.circular(20),
|
borderRadius: BorderRadius.circular(20),
|
||||||
child: Ink(
|
child: Ink(
|
||||||
height: 52,
|
height: 52,
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import 'package:eatvio_app/core/const.dart';
|
import 'package:eatvio_app/core/const.dart';
|
||||||
|
import 'package:eatvio_app/features/settings/entities/settings_entity.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_cubit.dart';
|
||||||
import 'package:eatvio_app/features/settings/presentation/bloc/settings_cubit/settings_state.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/locator_service.dart';
|
||||||
@@ -18,18 +19,24 @@ class SettingsScreen extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _SettingsScreenState extends State<SettingsScreen> {
|
class _SettingsScreenState extends State<SettingsScreen> {
|
||||||
|
final SettingsCubit settingsCubit = sl<SettingsCubit>()..init();
|
||||||
late bool updatesNotificationsSwitchState;
|
late bool updatesNotificationsSwitchState;
|
||||||
late bool fillDiaryNotificationsSwitchState;
|
late bool fillDiaryNotificationsSwitchState;
|
||||||
|
late bool bedTimeSwitchState;
|
||||||
|
late bool moodSwitchState;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return BlocProvider<SettingsCubit>(
|
return BlocProvider<SettingsCubit>(
|
||||||
create: (BuildContext context) => sl<SettingsCubit>()..init(),
|
create: (BuildContext context) => settingsCubit,
|
||||||
child: BlocConsumer<SettingsCubit, SettingsState>(
|
child: BlocConsumer<SettingsCubit, SettingsState>(
|
||||||
|
bloc: settingsCubit,
|
||||||
listener: (BuildContext context, SettingsState state) {
|
listener: (BuildContext context, SettingsState state) {
|
||||||
if (state is SettingsStateLoaded) {
|
if (state is SettingsStateLoaded) {
|
||||||
updatesNotificationsSwitchState = state.profileSettings.newUpdatesNotifications == 1 ? true : false;
|
updatesNotificationsSwitchState = state.profileSettings.newUpdatesNotifications == 1 ? true : false;
|
||||||
fillDiaryNotificationsSwitchState = state.profileSettings.diaryReminderNotifications == 1 ? true : false;
|
fillDiaryNotificationsSwitchState = state.profileSettings.diaryReminderNotifications == 1 ? true : false;
|
||||||
|
bedTimeSwitchState = state.profileSettings.isBedtimeFillable == 1 ? true : false;
|
||||||
|
moodSwitchState = state.profileSettings.isMoodFillable == 1 ? true : false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
builder: (BuildContext context, SettingsState state) {
|
builder: (BuildContext context, SettingsState state) {
|
||||||
@@ -100,10 +107,11 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
|||||||
_tile(
|
_tile(
|
||||||
onTap: () => GoRouter.of(context).pushNamed(
|
onTap: () => GoRouter.of(context).pushNamed(
|
||||||
'generalInfoScreen',
|
'generalInfoScreen',
|
||||||
extra: state.profileDetails,
|
extra: SettingsEntity(
|
||||||
pathParameters: {
|
profileSettingsModel: state.profileSettings,
|
||||||
'isPublicProfile': state.profileSettings.isPublicProfile.toString(),
|
profileDetailsModel: state.profileDetails,
|
||||||
},
|
settingsCubit: settingsCubit,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
title: 'Общая информация',
|
title: 'Общая информация',
|
||||||
),
|
),
|
||||||
@@ -111,7 +119,11 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
|||||||
_tile(
|
_tile(
|
||||||
onTap: () => GoRouter.of(context).pushNamed(
|
onTap: () => GoRouter.of(context).pushNamed(
|
||||||
'physicalFormScreen',
|
'physicalFormScreen',
|
||||||
extra: state.profileDetails,
|
extra: SettingsEntity(
|
||||||
|
profileSettingsModel: state.profileSettings,
|
||||||
|
profileDetailsModel: state.profileDetails,
|
||||||
|
settingsCubit: settingsCubit,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
title: 'Физическая форма',
|
title: 'Физическая форма',
|
||||||
),
|
),
|
||||||
@@ -119,7 +131,11 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
|||||||
_tile(
|
_tile(
|
||||||
onTap: () => GoRouter.of(context).pushNamed(
|
onTap: () => GoRouter.of(context).pushNamed(
|
||||||
'pressureScreen',
|
'pressureScreen',
|
||||||
extra: state.profileDetails,
|
extra: SettingsEntity(
|
||||||
|
profileSettingsModel: state.profileSettings,
|
||||||
|
profileDetailsModel: state.profileDetails,
|
||||||
|
settingsCubit: settingsCubit,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
title: 'Давление',
|
title: 'Давление',
|
||||||
),
|
),
|
||||||
@@ -127,7 +143,11 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
|||||||
_tile(
|
_tile(
|
||||||
onTap: () => GoRouter.of(context).pushNamed(
|
onTap: () => GoRouter.of(context).pushNamed(
|
||||||
'otherInfoScreen',
|
'otherInfoScreen',
|
||||||
extra: state.profileDetails,
|
extra: SettingsEntity(
|
||||||
|
profileSettingsModel: state.profileSettings,
|
||||||
|
profileDetailsModel: state.profileDetails,
|
||||||
|
settingsCubit: settingsCubit,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
title: 'Прочая информация',
|
title: 'Прочая информация',
|
||||||
),
|
),
|
||||||
@@ -135,10 +155,26 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
|||||||
_tile(
|
_tile(
|
||||||
onTap: () => GoRouter.of(context).pushNamed(
|
onTap: () => GoRouter.of(context).pushNamed(
|
||||||
'physicalActivityScreen',
|
'physicalActivityScreen',
|
||||||
extra: state.profileDetails,
|
extra: SettingsEntity(
|
||||||
|
profileSettingsModel: state.profileSettings,
|
||||||
|
profileDetailsModel: state.profileDetails,
|
||||||
|
settingsCubit: settingsCubit,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
title: 'Физическая нагрузка',
|
title: 'Физическая нагрузка',
|
||||||
),
|
),
|
||||||
|
_divider(context),
|
||||||
|
_tile(
|
||||||
|
onTap: () => GoRouter.of(context).pushNamed(
|
||||||
|
'changePasswordScreen',
|
||||||
|
extra: SettingsEntity(
|
||||||
|
profileSettingsModel: state.profileSettings,
|
||||||
|
profileDetailsModel: state.profileDetails,
|
||||||
|
settingsCubit: settingsCubit,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
title: 'Сменить пароль',
|
||||||
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -163,11 +199,11 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
|||||||
setState(() {
|
setState(() {
|
||||||
updatesNotificationsSwitchState = !updatesNotificationsSwitchState;
|
updatesNotificationsSwitchState = !updatesNotificationsSwitchState;
|
||||||
});
|
});
|
||||||
context.read<SettingsCubit>().updateProfileSettings(
|
settingsCubit.updateProfileSettings(
|
||||||
profileSettingsModel: state.profileSettings.copyWith(
|
profileSettingsModel: state.profileSettings.copyWith(
|
||||||
newUpdatesNotifications: updatesNotificationsSwitchState,
|
newUpdatesNotifications: updatesNotificationsSwitchState,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
title: 'Уведомление о новых обновлениях',
|
title: 'Уведомление о новых обновлениях',
|
||||||
trailing: CupertinoSwitch(
|
trailing: CupertinoSwitch(
|
||||||
@@ -177,11 +213,11 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
|||||||
setState(() {
|
setState(() {
|
||||||
updatesNotificationsSwitchState = newValue;
|
updatesNotificationsSwitchState = newValue;
|
||||||
});
|
});
|
||||||
context.read<SettingsCubit>().updateProfileSettings(
|
settingsCubit.updateProfileSettings(
|
||||||
profileSettingsModel: state.profileSettings.copyWith(
|
profileSettingsModel: state.profileSettings.copyWith(
|
||||||
newUpdatesNotifications: updatesNotificationsSwitchState,
|
newUpdatesNotifications: updatesNotificationsSwitchState,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -191,11 +227,11 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
|||||||
setState(() {
|
setState(() {
|
||||||
fillDiaryNotificationsSwitchState = !fillDiaryNotificationsSwitchState;
|
fillDiaryNotificationsSwitchState = !fillDiaryNotificationsSwitchState;
|
||||||
});
|
});
|
||||||
context.read<SettingsCubit>().updateProfileSettings(
|
settingsCubit.updateProfileSettings(
|
||||||
profileSettingsModel: state.profileSettings.copyWith(
|
profileSettingsModel: state.profileSettings.copyWith(
|
||||||
diaryReminderNotifications: fillDiaryNotificationsSwitchState,
|
diaryReminderNotifications: fillDiaryNotificationsSwitchState,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
title: 'Напоминание о заполнении дневника',
|
title: 'Напоминание о заполнении дневника',
|
||||||
trailing: CupertinoSwitch(
|
trailing: CupertinoSwitch(
|
||||||
@@ -205,11 +241,67 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
|||||||
setState(() {
|
setState(() {
|
||||||
fillDiaryNotificationsSwitchState = newValue;
|
fillDiaryNotificationsSwitchState = newValue;
|
||||||
});
|
});
|
||||||
context.read<SettingsCubit>().updateProfileSettings(
|
settingsCubit.updateProfileSettings(
|
||||||
profileSettingsModel: state.profileSettings.copyWith(
|
profileSettingsModel: state.profileSettings.copyWith(
|
||||||
diaryReminderNotifications: fillDiaryNotificationsSwitchState,
|
diaryReminderNotifications: fillDiaryNotificationsSwitchState,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
_divider(context),
|
||||||
|
_tile(
|
||||||
|
onTap: () {
|
||||||
|
setState(() {
|
||||||
|
moodSwitchState = !moodSwitchState;
|
||||||
|
});
|
||||||
|
settingsCubit.updateProfileSettings(
|
||||||
|
profileSettingsModel: state.profileSettings.copyWith(
|
||||||
|
isMoodFillable: moodSwitchState,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
title: 'Указывать “настроение” в заполнение дневника',
|
||||||
|
trailing: CupertinoSwitch(
|
||||||
|
value: moodSwitchState,
|
||||||
|
activeColor: appTheme.blueA400,
|
||||||
|
onChanged: (newValue) {
|
||||||
|
setState(() {
|
||||||
|
moodSwitchState = newValue;
|
||||||
|
});
|
||||||
|
settingsCubit.updateProfileSettings(
|
||||||
|
profileSettingsModel: state.profileSettings.copyWith(
|
||||||
|
isMoodFillable: moodSwitchState,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
_divider(context),
|
||||||
|
_tile(
|
||||||
|
onTap: () {
|
||||||
|
setState(() {
|
||||||
|
bedTimeSwitchState = !bedTimeSwitchState;
|
||||||
|
});
|
||||||
|
settingsCubit.updateProfileSettings(
|
||||||
|
profileSettingsModel: state.profileSettings.copyWith(
|
||||||
|
isBedtimeFillable: bedTimeSwitchState,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
title: 'Указывать “отход ко сну” в заполнение дневника',
|
||||||
|
trailing: CupertinoSwitch(
|
||||||
|
value: bedTimeSwitchState,
|
||||||
|
activeColor: appTheme.blueA400,
|
||||||
|
onChanged: (newValue) {
|
||||||
|
setState(() {
|
||||||
|
bedTimeSwitchState = newValue;
|
||||||
|
});
|
||||||
|
settingsCubit.updateProfileSettings(
|
||||||
|
profileSettingsModel: state.profileSettings.copyWith(
|
||||||
|
isBedtimeFillable: bedTimeSwitchState,
|
||||||
|
),
|
||||||
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -264,7 +356,6 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
|||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
height: 1,
|
height: 1,
|
||||||
fontWeight: FontWeight.w600,
|
|
||||||
fontSize: 18,
|
fontSize: 18,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -293,7 +384,6 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
|||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Colors.black,
|
color: Colors.black,
|
||||||
height: 1,
|
height: 1,
|
||||||
fontWeight: FontWeight.w600,
|
|
||||||
fontSize: 18,
|
fontSize: 18,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -64,11 +64,11 @@ class CustomDropDown extends StatelessWidget {
|
|||||||
value: value,
|
value: value,
|
||||||
isDense: true,
|
isDense: true,
|
||||||
isExpanded: true,
|
isExpanded: true,
|
||||||
style: textStyle ??
|
style: TextStyle(
|
||||||
TextStyle(
|
fontSize: 16,
|
||||||
fontSize: 16,
|
color: Colors.black,
|
||||||
fontWeight: FontWeight.w400,
|
fontWeight: FontWeight.w400,
|
||||||
),
|
),
|
||||||
items: items?.map((SelectionPopupModel item) {
|
items: items?.map((SelectionPopupModel item) {
|
||||||
return DropdownMenuItem<SelectionPopupModel>(
|
return DropdownMenuItem<SelectionPopupModel>(
|
||||||
value: item,
|
value: item,
|
||||||
@@ -95,6 +95,11 @@ class CustomDropDown extends StatelessWidget {
|
|||||||
|
|
||||||
InputDecoration _buildInputDecoration(BuildContext context) {
|
InputDecoration _buildInputDecoration(BuildContext context) {
|
||||||
return InputDecoration(
|
return InputDecoration(
|
||||||
|
labelStyle: TextStyle(
|
||||||
|
fontSize: 16,
|
||||||
|
color: Colors.black,
|
||||||
|
fontWeight: FontWeight.w400,
|
||||||
|
),
|
||||||
hintText: hintText ?? "",
|
hintText: hintText ?? "",
|
||||||
hintStyle: hintStyle ??
|
hintStyle: hintStyle ??
|
||||||
TextStyle(
|
TextStyle(
|
||||||
|
|||||||
Reference in New Issue
Block a user