forked from eatvio/eatvio_app
Fixed image display and added measurements edit dialog
This commit is contained in:
@@ -57,6 +57,9 @@ class MyProfileBloc extends Bloc<MyProfileEvent, MyProfileState> {
|
||||
userDetails: data['userDetails'],
|
||||
chartPoints: data['chartPoints'],
|
||||
plans: data['plans'],
|
||||
chestCircumferenceController: TextEditingController(),
|
||||
waistCircumferenceController: TextEditingController(),
|
||||
hipCircumferenceController: TextEditingController(),
|
||||
circumferences: data['circumferences'],
|
||||
));
|
||||
}
|
||||
|
||||
@@ -5,7 +5,10 @@ part of 'my_profile_bloc.dart';
|
||||
/// Represents the state of MyProfile in the application.
|
||||
class MyProfileState extends Equatable {
|
||||
MyProfileState(
|
||||
{this.myProfileModelObj,
|
||||
{this.chestCircumferenceController,
|
||||
this.waistCircumferenceController,
|
||||
this.hipCircumferenceController,
|
||||
this.myProfileModelObj,
|
||||
this.user,
|
||||
this.userDetails,
|
||||
this.chartPoints,
|
||||
@@ -16,25 +19,47 @@ class MyProfileState extends Equatable {
|
||||
Map<String, dynamic>? user;
|
||||
Map<String, dynamic>? userDetails;
|
||||
Map<String, dynamic>? chartPoints;
|
||||
List<dynamic>? plans;
|
||||
Map<String, dynamic>? circumferences;
|
||||
List<dynamic>? plans;
|
||||
TextEditingController? chestCircumferenceController;
|
||||
TextEditingController? waistCircumferenceController;
|
||||
TextEditingController? hipCircumferenceController;
|
||||
|
||||
@override
|
||||
List<Object?> get props =>
|
||||
[myProfileModelObj, user, chartPoints, circumferences, plans];
|
||||
MyProfileState copyWith(
|
||||
{MyProfileModel? myProfileModelObj,
|
||||
Map<String, dynamic>? user,
|
||||
Map<String, dynamic>? userDetails,
|
||||
List<dynamic>? plans,
|
||||
Map<String, dynamic>? chartPoints,
|
||||
Map<String, dynamic>? circumferences}) {
|
||||
List<Object?> get props => [
|
||||
myProfileModelObj,
|
||||
user,
|
||||
chartPoints,
|
||||
circumferences,
|
||||
plans,
|
||||
chestCircumferenceController,
|
||||
waistCircumferenceController,
|
||||
hipCircumferenceController
|
||||
];
|
||||
MyProfileState copyWith({
|
||||
MyProfileModel? myProfileModelObj,
|
||||
Map<String, dynamic>? user,
|
||||
Map<String, dynamic>? userDetails,
|
||||
List<dynamic>? plans,
|
||||
Map<String, dynamic>? chartPoints,
|
||||
Map<String, dynamic>? circumferences,
|
||||
TextEditingController? chestCircumferenceController,
|
||||
TextEditingController? waistCircumferenceController,
|
||||
TextEditingController? hipCircumferenceController,
|
||||
}) {
|
||||
return MyProfileState(
|
||||
myProfileModelObj: myProfileModelObj ?? this.myProfileModelObj,
|
||||
user: user ?? this.user,
|
||||
plans: plans ?? this.plans,
|
||||
userDetails: userDetails ?? this.userDetails,
|
||||
circumferences: circumferences ?? this.circumferences,
|
||||
chartPoints: chartPoints ?? this.chartPoints);
|
||||
myProfileModelObj: myProfileModelObj ?? this.myProfileModelObj,
|
||||
user: user ?? this.user,
|
||||
plans: plans ?? this.plans,
|
||||
userDetails: userDetails ?? this.userDetails,
|
||||
circumferences: circumferences ?? this.circumferences,
|
||||
chartPoints: chartPoints ?? this.chartPoints,
|
||||
chestCircumferenceController:
|
||||
chestCircumferenceController ?? this.chestCircumferenceController,
|
||||
waistCircumferenceController:
|
||||
waistCircumferenceController ?? this.waistCircumferenceController,
|
||||
hipCircumferenceController:
|
||||
hipCircumferenceController ?? this.hipCircumferenceController,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ 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/app_bar/exit_button.dart';
|
||||
import 'package:eatvio_app/widgets/next_step_button.dart';
|
||||
import 'package:eatvio_app/widgets/custom_text_form_field.dart';
|
||||
import 'package:carousel_slider/carousel_slider.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
||||
@@ -100,21 +101,25 @@ class MyProfileScreen extends StatelessWidget {
|
||||
.toList()),
|
||||
]);
|
||||
case 3: //График обхватов
|
||||
return Column(children: [
|
||||
Text(
|
||||
"circumferences_chart".tr,
|
||||
style: CustomTextStyles.titleMediumBlack
|
||||
.copyWith(
|
||||
color: appTheme.black900,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 50.v),
|
||||
_buildCircumferenceChart(
|
||||
context,
|
||||
state.circumferences,
|
||||
)
|
||||
]);
|
||||
case 4: //График обхватов
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
_showAddMeasurementDialog(context);
|
||||
},
|
||||
child: Column(children: [
|
||||
Text(
|
||||
"circumferences_chart".tr,
|
||||
style: CustomTextStyles.titleMediumBlack
|
||||
.copyWith(
|
||||
color: appTheme.black900,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 50.v),
|
||||
_buildCircumferenceChart(
|
||||
context,
|
||||
state.circumferences,
|
||||
)
|
||||
]));
|
||||
case 4:
|
||||
return NextStepButton(
|
||||
buttonStyle:
|
||||
CustomButtonStyles.outlinePrimaryTL15,
|
||||
@@ -678,3 +683,67 @@ class MyProfileScreen extends StatelessWidget {
|
||||
return bmiList;
|
||||
}
|
||||
}
|
||||
|
||||
_showAddMeasurementDialog(BuildContext context) async {
|
||||
return showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return AlertDialog(
|
||||
title: Text("Добавить замер"),
|
||||
content: Column(
|
||||
children: [
|
||||
BlocSelector<MyProfileBloc, MyProfileState, TextEditingController?>(
|
||||
selector: (state) => state.chestCircumferenceController,
|
||||
builder: (context, chestCircumferenceController) {
|
||||
return TextField(
|
||||
controller: chestCircumferenceController,
|
||||
keyboardType: TextInputType.number,
|
||||
decoration:
|
||||
InputDecoration(labelText: "chest_circumference".tr),
|
||||
);
|
||||
}),
|
||||
BlocSelector<MyProfileBloc, MyProfileState, TextEditingController?>(
|
||||
selector: (state) => state.waistCircumferenceController,
|
||||
builder: (context, waistCircumferenceController) {
|
||||
return TextField(
|
||||
controller: waistCircumferenceController,
|
||||
keyboardType: TextInputType.number,
|
||||
decoration:
|
||||
InputDecoration(labelText: "waist_circumference".tr),
|
||||
);
|
||||
}),
|
||||
BlocSelector<MyProfileBloc, MyProfileState, TextEditingController?>(
|
||||
selector: (state) => state.hipCircumferenceController,
|
||||
builder: (context, hipCircumferenceController) {
|
||||
return TextField(
|
||||
controller: hipCircumferenceController,
|
||||
keyboardType: TextInputType.number,
|
||||
decoration:
|
||||
InputDecoration(labelText: "hip_circumference".tr),
|
||||
);
|
||||
}),
|
||||
],
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
child: Text("Отмена"),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
// Отправка данных на API
|
||||
// Закрытие диалогового окна
|
||||
Navigator.pop(context);
|
||||
},
|
||||
child: Text("Изменить"),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
_sendDataToApi(String chestCircumference, String waistCircumference,
|
||||
String hipCircumference) {}
|
||||
|
||||
Reference in New Issue
Block a user