diff --git a/lib/presentation/profile/my_profile_screen/my_settings_screen.dart b/lib/presentation/profile/my_profile_screen/my_settings_screen.dart index d03faece..09e520e1 100644 --- a/lib/presentation/profile/my_profile_screen/my_settings_screen.dart +++ b/lib/presentation/profile/my_profile_screen/my_settings_screen.dart @@ -236,6 +236,7 @@ class _HyperState extends State { onChanged: (value) { setState(() { switchValue = value; + widget.state!.hyperFormController = value ? "1" : "0"; }); }, inactiveThumbColor: appTheme.blueA400, @@ -283,6 +284,7 @@ class _HypoState extends State { onChanged: (value) { setState(() { switchValue = value; + widget.state!.hypoFormController = value ? "1" : "0"; }); }, inactiveThumbColor: appTheme.blueA400, @@ -439,7 +441,7 @@ class _ExpandableListState extends State { decoration: InputDecoration(labelText: 'country'.tr), ), DropdownButtonFormField( - hint: Text(state.cityFormController!.text), + hint: Text(state.selectedCity ?? "Не выбрано"), value: state.selectedCity, onChanged: (newValue) { // Обработчик изменения выбранного города @@ -525,10 +527,13 @@ class _ExpandableListState extends State { ), Row( children: [ - HypoSwitch('do_you_have_hypertension_tendency'.tr, state), + HyperSwitch('do_you_have_hypertension_tendency'.tr, state), ], ), NextStepButton( + onPressed: () { + sendProfileData(state); + }, buttonStyle: CustomButtonStyles.outlinePrimaryTL15, text: "save".tr.toUpperCase(), margin: EdgeInsets.only(top: 20.h, bottom: 20.h)), @@ -551,19 +556,29 @@ class _ExpandableListState extends State { try { // Создаем JSON объект с данными профиля Map profileData = { - 'weight': state?.weightController?.text, - 'chestCircumference': state?.chestCircumferenceController?.text, - 'waistCircumference': state?.waistCircumferenceController?.text, - 'hipCircumference': state?.hipCircumferenceController?.text, - 'firstName': state?.firstNameFormController?.text, - 'lastName': state?.lastNameFormController?.text, + 'first_name': state?.firstNameFormController?.text, + 'last_name': state?.lastNameFormController?.text, + 'chest_circumference': state?.chestCircumferenceFormController?.text, + 'waist_circumference': state?.waistCircumferenceFormController?.text, + 'hip_circumference': state?.hipCircumferenceFormController?.text, + 'birthdate': state?.dateFormController?.text, + 'height': state?.heightFormController?.text, + 'weight': state?.weightFormController?.text, + 'blood_pressure_up': state?.upPressureFormController?.text, + 'blood_pressure_down': state?.downPressureFormController?.text, + 'about_alergy': state?.allergiesFormController?.text, + 'about_taking_pils': state?.pillsFormController?.text, + 'about_sport_hobbies': state?.sportsFormController?.text, + 'favorite_foods': state?.favoriteFormController?.text, + 'unfavorite_foods': state?.unfavoriteFormController?.text, + 'additional_info': state?.additionalFormController?.text, 'country': state?.selectedCountry, 'city': state?.selectedCity, - 'hypoFormController': state?.hypoFormController, - 'hyperFormController': state?.hyperFormController, - // добавьте остальные поля здесь + 'has_hypo': state?.hypoFormController, + 'has_hyper': state?.hyperFormController, }; + print(profileData); // Отправляем JSON на сервер String apiUrl = dotenv.env['SERVER_ROOT']! + 'profile/edit'; http.Response response = await http.post(