feat(diary) Finished static layouts

This commit is contained in:
2024-02-14 13:44:50 +03:00
parent 2c2508840d
commit 2fdf3979da
3 changed files with 250 additions and 101 deletions

View File

@@ -2,10 +2,9 @@ import 'bloc/diary_edit_bloc.dart';
import 'models/diary_edit_model.dart';
import 'package:flutter/material.dart';
import 'package:eatvio_app/core/app_export.dart';
import 'package:eatvio_app/widgets/custom_text_form_field.dart';
import 'package:eatvio_app/widgets/custom_edit_text_form_field.dart';
import 'package:eatvio_app/widgets/custom_edit_drop_down.dart';
import 'package:eatvio_app/widgets/custom_outlined_button.dart';
import 'package:eatvio_app/widgets/custom_icon_button.dart';
// ignore: must_be_immutable
class DiaryEditScreen extends StatelessWidget {
@@ -14,12 +13,6 @@ class DiaryEditScreen extends StatelessWidget {
key: key,
);
List<String> dropdownItemList = [
"Item One",
"Item Two",
"Item Three",
];
List<String> mealList = [
"Прием пищи 1",
"Прием пищи 2",
@@ -29,10 +22,13 @@ class DiaryEditScreen extends StatelessWidget {
"Прием пищи 6",
];
List<String> dropdownItemList2 = [
"Item One",
"Item Two",
"Item Three",
List<String> satietyList = [
"Ужасное",
"Плохое",
"Удовлетворительное",
"Нормальное",
"Хорошее",
"Прекрасное",
];
List<String> moodList = [
@@ -169,16 +165,6 @@ class DiaryEditScreen extends StatelessWidget {
);
}
/// Section Widget
Widget _buildEnterProductName(BuildContext context) {
return Padding(
padding: EdgeInsets.symmetric(horizontal: 8.h),
child: CustomTextFormField(
hintText: "Введите названия продукта",
),
);
}
/// Section Widget
Widget _buildAddProduct(BuildContext context) {
return CustomOutlinedButton(
@@ -242,7 +228,7 @@ class DiaryEditScreen extends StatelessWidget {
padding: EdgeInsets.symmetric(horizontal: 10.h),
child: ConstrainedBox(
constraints: BoxConstraints(
maxWidth: MediaQuery.of(context).size.width - 210,
maxWidth: MediaQuery.of(context).size.width - 247,
),
child: CustomTextFormField(
hintText: "14:52",
@@ -259,19 +245,24 @@ class DiaryEditScreen extends StatelessWidget {
hintText: "Прием пищи",
items: mealList,
contentPadding: EdgeInsets.symmetric(
horizontal: 15.h,
horizontal: 10.h,
vertical: 9.v,
),
onChanged: (value) {},
),
),
SizedBox(height: 20.v),
_buildEnterProductName(context),
Padding(
padding: EdgeInsets.symmetric(horizontal: 10.h),
child: CustomTextFormField(
hintText: "Введите названия продукта",
),
),
SizedBox(height: 20.v),
Padding(
padding: EdgeInsets.symmetric(horizontal: 10.h),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
CustomTextFormField(
width: 146.h,
@@ -279,7 +270,7 @@ class DiaryEditScreen extends StatelessWidget {
textInputAction: TextInputAction.done,
),
Padding(
padding: EdgeInsets.only(left: 10.h),
padding: EdgeInsets.only(right: 30.h),
child: Text(
"порций",
style: CustomTextStyles.bodyMediumBlack900,
@@ -288,16 +279,28 @@ class DiaryEditScreen extends StatelessWidget {
),
),
SizedBox(height: 30.v),
_buildAddProduct(context),
SizedBox(height: 30.v),
//_buildAddPhoto(context),
SizedBox(height: 29.v),
Text(
"Ваша сытость после приёма пищи",
style: CustomTextStyles.bodyMediumBlack900,
),
SizedBox(height: 15.v),
CustomDropDown(
icon: Container(
margin: EdgeInsets.fromLTRB(30.h, 30.v, 20.h, 30.v),
child: CustomImageView(
imagePath: ImageConstant.imgArrowLeft,
height: 10.v,
width: 18.h,
),
),
hintText: "Сытость",
items: satietyList,
borderDecoration: InputBorder.none,
onChanged: (value) {},
),
],
),
));
@@ -736,77 +739,80 @@ class DiaryEditScreen extends StatelessWidget {
bottom: 41.v,
),
buttonStyle: CustomButtonStyles.outlinePrimaryTL15,
decoration: BoxDecoration(
color: Colors.transparent,
), // Установите прозрачный фон
);
}
}
Widget _buildMood(
List<String> moodList, BuildContext context, DiaryEditLoadedState state) {
return Padding(
padding: EdgeInsets.symmetric(horizontal: 16.h),
child: Container(
padding: EdgeInsets.symmetric(
horizontal: 24.h,
vertical: 12.v,
),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(12),
boxShadow: [
BoxShadow(
color: Colors.grey.withOpacity(0.5),
spreadRadius: 2,
blurRadius: 5,
offset: Offset(0, 3),
),
],
),
child: Column(children: [
GestureDetector(
onTap: () {
/*BlocProvider.of<DiaryEditBloc>(context)
.add(ToggleWakeupExpandedEvent());*/
},
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
"Ваше настроение после приема пищи",
style: CustomTextStyles.bodyMediumBlack900,
),
Icon(state.wakeupExpanded
? Icons.arrow_drop_up
: Icons.arrow_drop_down),
],
),
Widget _buildMood(
List<String> moodList, BuildContext context, DiaryEditLoadedState state) {
return Padding(
padding: EdgeInsets.symmetric(horizontal: 16.h),
child: Container(
padding: EdgeInsets.symmetric(
horizontal: 24.h,
vertical: 12.v,
),
if (state.moodExpanded)
CustomDropDown(
icon: Container(
margin: EdgeInsets.fromLTRB(30.h, 30.v, 20.h, 30.v),
child: CustomImageView(
imagePath: ImageConstant.imgArrowLeft,
height: 10.v,
width: 18.h,
),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(12),
boxShadow: [
BoxShadow(
color: Colors.grey.withOpacity(0.5),
spreadRadius: 2,
blurRadius: 5,
offset: Offset(0, 3),
),
],
),
child: Column(children: [
GestureDetector(
onTap: () {
/*BlocProvider.of<DiaryEditBloc>(context)
.add(ToggleWakeupExpandedEvent());*/
},
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
"Ваше настроение после приема пищи",
style: CustomTextStyles.bodyMediumBlack900,
),
Icon(state.wakeupExpanded
? Icons.arrow_drop_up
: Icons.arrow_drop_down),
],
),
hintText: "Ваше настроение после приема пищи",
items: moodList,
onChanged: (value) {},
),
])));
}
Future<void> _selectTime(
BuildContext context, DiaryEditLoadedState state) async {
final TimeOfDay? pickedTime = await showTimePicker(
context: context,
initialTime: state.wakeupController ?? TimeOfDay.now(),
);
if (pickedTime != null && pickedTime != state.wakeupController) {
state.wakeupController = pickedTime;
if (state.moodExpanded)
CustomDropDown(
icon: Container(
margin: EdgeInsets.fromLTRB(30.h, 30.v, 20.h, 30.v),
child: CustomImageView(
imagePath: ImageConstant.imgArrowLeft,
height: 10.v,
width: 18.h,
),
),
hintText: "Ваше настроение после приема пищи",
items: moodList,
borderDecoration: InputBorder.none,
onChanged: (value) {},
),
])));
}
Future<void> _selectTime(
BuildContext context, DiaryEditLoadedState state) async {
final TimeOfDay? pickedTime = await showTimePicker(
context: context,
initialTime: state.wakeupController ?? TimeOfDay.now(),
);
if (pickedTime != null && pickedTime != state.wakeupController) {
state.wakeupController = pickedTime;
}
}
}
/*Widget _buildImageStack(BuildContext context) {
return Container(
@@ -1032,4 +1038,5 @@ Future<void> _selectTime(
],
),
);
}*/
}*/
}