New inputs for profile edit form

This commit is contained in:
2024-01-30 11:36:33 +03:00
parent 1dbc946a6b
commit 901e23fa44
3 changed files with 148 additions and 126 deletions

View File

@@ -40,12 +40,12 @@ final Map<String, String> ru = {
// blood_pressure Screen
"no": "Нет",
"do_you_have_hypertension_tendency": "Есть ли у вас склонность к гипертонии?",
"do_you_have_hypertension_tendency": "Есть ли у вас гипертония?",
"your_blood_pressure": "Ваше артериальное давление?",
"average_pressure": "Средние показатели давления:",
"up_pressure": "Верхние показатели давления:",
"down_pressure": "Нижние показатели давления:",
"do_you_have_hypotension_tendency": "Есть ли у вас склонность к гипотонии?",
"do_you_have_hypotension_tendency": "Есть ли у вас гипотония?",
// favorite_sports Screen
"your_favorite_sports": "Ваши спортивные увлечения?",
@@ -131,4 +131,5 @@ final Map<String, String> ru = {
"chat": "Чат",
"admin": "Админ",
"diary": "Дневник",
"save": "Сохранить",
};

View File

@@ -151,7 +151,7 @@ class MyProfileScreen extends StatelessWidget {
Widget _buildCarousel(BuildContext contex, MyProfileLoadedState state) {
return CarouselSlider(
options: CarouselOptions(height: 375.0),
options: CarouselOptions(height: 340.0),
items: [1, 2, 3].map((chartType) {
return Builder(
builder: (BuildContext context) {
@@ -643,8 +643,8 @@ class MyProfileScreen extends StatelessWidget {
Padding(
padding: EdgeInsets.only(left: 15.h),
child: Text("plans_complete".tr,
style: CustomTextStyles.titleMediumBlack.copyWith(
color: appTheme.black900))),
style: CustomTextStyles.titleMediumBlack
.copyWith(color: appTheme.black900))),
SizedBox(height: 5.v),
Container(
decoration: AppDecoration.outlineBlueGray
@@ -653,7 +653,7 @@ class MyProfileScreen extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
height: 94.v,
height: 120.v,
width: 343.h,
child:
Stack(alignment: Alignment.bottomCenter, children: [

View File

@@ -8,6 +8,7 @@ import 'package:eatvio_app/widgets/app_bar/appbar_leading_image.dart';
import 'package:eatvio_app/widgets/app_bar/custom_app_bar.dart';
import 'package:eatvio_app/widgets/custom_bottom_bar.dart';
import 'package:eatvio_app/widgets/custom_text_form_field.dart';
import 'package:eatvio_app/widgets/next_step_button.dart';
import 'package:flutter/material.dart';
class MySettingsScreen extends StatelessWidget {
@@ -19,18 +20,18 @@ class MySettingsScreen extends StatelessWidget {
child: MySettingsScreen());
}
Widget build(BuildContext context) {
Widget build(BuildContext context) {
return BlocBuilder<MyProfileBloc, MyProfileState>(
builder: (context, state) {
if (state is MyProfileInitialState) {
// Это начальное состояние, данные ещё не загружены.
return CircularProgressIndicator(color: Colors.white, backgroundColor: Colors.white,);
return CircularProgressIndicator(
color: Colors.white,
backgroundColor: Colors.white,
);
} else if (state is MyProfileLoadedState) {
// Данные загружены, можно строить экран.
return _buildSetingsScreen(context, state);
} else if (state is MyProfileErrorState) {
// Произошла ошибка при загрузке данных.
return Center(child: Text(state.errorMessage));
} else {
// Другие состояния, если они есть.
return Container(); // Пустой контейнер для необработанных состояний.
@@ -41,22 +42,22 @@ class MySettingsScreen extends StatelessWidget {
Widget _buildSetingsScreen(BuildContext context, MyProfileLoadedState state) {
mediaQueryData = MediaQuery.of(context);
final List<String> userDetails = [
state.userDetails!['first_name'],
state.userDetails!['last_name'],
state.userDetails!['weight'].toString(),
state.userDetails!['height'].toString(),
state.userDetails!['chest_circumference'].toString(),
state.userDetails!['waist_circumference'].toString(),
state.userDetails!['hip_circumference'].toString(),
];
return SafeArea(
child: Scaffold(
appBar: _buildAppBar(context, "my_settings".tr),
body: Padding(
padding: const EdgeInsets.all(16.0),
final List<String> userDetails = [
state.userDetails!['first_name'],
state.userDetails!['last_name'],
state.userDetails!['weight'].toString(),
state.userDetails!['height'].toString(),
state.userDetails!['chest_circumference'].toString(),
state.userDetails!['waist_circumference'].toString(),
state.userDetails!['hip_circumference'].toString(),
];
return SafeArea(
child: Scaffold(
appBar: _buildAppBar(context, "my_settings".tr),
body: Padding(
padding: const EdgeInsets.all(16.0),
child: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
SectionTitle('Язык'),
LanguageDropdown(),
@@ -69,7 +70,8 @@ class MySettingsScreen extends StatelessWidget {
],
),
),
bottomNavigationBar: _buildBottomBar(context)));
),
bottomNavigationBar: _buildBottomBar(context)));
}
/// Section Widget
@@ -198,6 +200,45 @@ class _NotificationSwitchState extends State<NotificationSwitch> {
}
}
class HypoHyperSwitch extends StatefulWidget {
final String title;
HypoHyperSwitch(this.title);
@override
_HypoHyperState createState() => _HypoHyperState();
}
class _HypoHyperState extends State<HypoHyperSwitch> {
bool switchValue = false;
@override
Widget build(BuildContext context) {
return Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
widget.title,
style: TextStyle(
color: Colors.black, fontSize: 14, fontWeight: FontWeight.bold),
),
Switch(
value: switchValue,
onChanged: (value) {
setState(() {
switchValue = value;
});
},
inactiveThumbColor: appTheme.blueA400,
inactiveTrackColor: Colors.white,
activeTrackColor: appTheme.blueA400,
activeColor: Colors.white,
),
],
);
}
}
class ExpandableList extends StatefulWidget {
final String title;
final List<String> items;
@@ -213,7 +254,8 @@ class _ExpandableListState extends State<ExpandableList> {
@override
Widget build(BuildContext context) {
return ListView(
return Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
GestureDetector(
onTap: () {
@@ -238,104 +280,83 @@ class _ExpandableListState extends State<ExpandableList> {
if (isExpanded)
Padding(
padding: const EdgeInsets.only(left: 16.0),
child: Column(
children: [
TextField(
decoration: InputDecoration(labelText: 'first_name'.tr),
),
TextField(
decoration: InputDecoration(labelText: 'last_name'.tr),
),
// Поле даты рождения, предполагается, что 'reg_form.date_of_birth' это функция для получения даты рождения
TextField(
decoration: InputDecoration(labelText: 'date_of_birth'.tr),
onTap: () {
// Вставьте здесь логику для отображения выбора даты
},
),
// Поле выбора пола
Row(
children: [
Radio(value: 'male'.tr, groupValue: null, onChanged: null),
Text('Male'),
Radio(value: 'female'.tr, groupValue: null, onChanged: null),
Text('Female'),
],
),
TextField(
decoration: InputDecoration(labelText: 'country'.tr),
),
TextField(
decoration: InputDecoration(labelText: 'place_of_living'.tr),
),
// Поле выбора языка
DropdownButton<String>(
value: null,
onChanged: (newValue) {
// Вставьте здесь логику для обработки выбора языка
},
items: ['russian'.tr].map((String language) {
return DropdownMenuItem<String>(
value: language,
child: Text(language),
);
}).toList(),
),
// Поля для ввода чисел
TextField(
decoration: InputDecoration(labelText: 'weight_measurements'.tr),
keyboardType: TextInputType.number,
),
TextField(
decoration: InputDecoration(labelText: 'height_measurements'.tr),
keyboardType: TextInputType.number,
),
TextField(
decoration: InputDecoration(labelText: 'chest_circumference'.tr),
keyboardType: TextInputType.number,
),
TextField(
decoration: InputDecoration(labelText: 'waist_circumference'.tr),
keyboardType: TextInputType.number,
),
TextField(
decoration: InputDecoration(labelText: 'hip_circumference'.tr),
keyboardType: TextInputType.number,
),
TextField(
decoration: InputDecoration(labelText: 'up_pressure'.tr),
keyboardType: TextInputType.number,
),
TextField(
decoration: InputDecoration(labelText: 'down_pressure'),
keyboardType: TextInputType.number,
),
// Переключатели
Row(
children: [
Switch(value: false, onChanged: null),
Text('do_you_have_hypotension_tendency'.tr),
],
),
Row(
children: [
Switch(value: false, onChanged: null),
Text('do_you_have_hypertension_tendency'.tr),
],
),
// Поля для ввода текста
TextField(
decoration: InputDecoration(labelText: 'allergies_presence'.tr),
maxLines: null,
),
TextField(
decoration: InputDecoration(labelText: 'do_you_take_pills'.tr),
maxLines: null,
),
TextField(
decoration: InputDecoration(labelText: 'your_favorite_sports'.tr),
maxLines: null,
),]),
child: Column(children: [
TextField(
decoration: InputDecoration(labelText: 'first_name'.tr),
),
TextField(
decoration: InputDecoration(labelText: 'last_name'.tr),
),
TextField(
decoration: InputDecoration(labelText: 'date_of_birth'.tr),
onTap: () {},
),
TextField(
decoration: InputDecoration(labelText: 'country'.tr),
),
TextField(
decoration: InputDecoration(labelText: 'place_of_living'.tr),
),
TextField(
decoration:
InputDecoration(labelText: 'weight_measurements'.tr),
keyboardType: TextInputType.number,
),
TextField(
decoration:
InputDecoration(labelText: 'height_measurements'.tr),
keyboardType: TextInputType.number,
),
TextField(
decoration:
InputDecoration(labelText: 'chest_circumference'.tr),
keyboardType: TextInputType.number,
),
TextField(
decoration:
InputDecoration(labelText: 'waist_circumference'.tr),
keyboardType: TextInputType.number,
),
TextField(
decoration: InputDecoration(labelText: 'hip_circumference'.tr),
keyboardType: TextInputType.number,
),
TextField(
decoration: InputDecoration(labelText: 'up_pressure'.tr),
keyboardType: TextInputType.number,
),
TextField(
decoration: InputDecoration(labelText: 'down_pressure'.tr),
keyboardType: TextInputType.number,
),
TextField(
decoration: InputDecoration(labelText: 'allergies_presence'.tr),
maxLines: null,
),
TextField(
decoration: InputDecoration(labelText: 'do_you_take_pills'.tr),
maxLines: null,
),
TextField(
decoration:
InputDecoration(labelText: 'your_favorite_sports'.tr),
maxLines: null,
),
Row(
children: [
HypoHyperSwitch('do_you_have_hypotension_tendency'.tr),
],
),
Row(
children: [
HypoHyperSwitch('do_you_have_hypertension_tendency'.tr),
],
),
NextStepButton(
buttonStyle: CustomButtonStyles.outlinePrimaryTL15,
text: "save".tr.toUpperCase(),
margin: EdgeInsets.only(top: 20.h, bottom: 20.h)),
]),
),
Divider(),
],