feat(feed, profile): добавлен переход на страинцу автора в посте, рецепте и дете. при нажатии на изображение в рецепте и диеты теперь переход на страницу с подробнее.

This commit is contained in:
mso7nueh
2024-08-14 11:34:29 +03:00
parent 1e992e9dd6
commit 919035a455
77 changed files with 3943 additions and 2745 deletions

View File

@@ -1,6 +1,7 @@
// ignore_for_file: unused_local_variable
import 'package:carousel_slider_plus/carousel_slider_plus.dart';
import 'package:eatvio_app/core/app_export.dart';
import 'package:eatvio_app/features/diary/models/diary_model.dart';
import 'package:eatvio_app/features/diary/models/meal.dart';
import 'package:eatvio_app/features/diary/models/photo.dart';
@@ -8,15 +9,13 @@ import 'package:eatvio_app/features/diary/models/portion.dart';
import 'package:eatvio_app/features/diary/models/product.dart';
import 'package:eatvio_app/features/diary/presentation/bloc/diary_bloc.dart';
import 'package:eatvio_app/features/diary/presentation/bloc/diary_state.dart';
import 'package:eatvio_app/core/app_export.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_edit_text_form_field.dart';
import 'package:eatvio_app/widgets/custom_outlined_button.dart';
import 'package:eatvio_app/widgets/custom_scale_element.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter_form_builder/flutter_form_builder.dart';
import 'package:image_picker/image_picker.dart';
import 'package:syncfusion_flutter_charts/charts.dart';
@@ -176,14 +175,10 @@ class DiaryScreen extends StatelessWidget {
Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Text(
'${state.chartData![3].nutrition.toStringAsFixed(0)}%'), // Калории
Text(
'${state.chartData![2].nutrition.toStringAsFixed(0)}%'), // Белки
Text(
'${state.chartData![1].nutrition.toStringAsFixed(0)}%'), // Жиры
Text(
'${state.chartData![0].nutrition.toStringAsFixed(0)}% '), // Углеводы
Text('${state.chartData![3].nutrition.toStringAsFixed(0)}%'), // Калории
Text('${state.chartData![2].nutrition.toStringAsFixed(0)}%'), // Белки
Text('${state.chartData![1].nutrition.toStringAsFixed(0)}%'), // Жиры
Text('${state.chartData![0].nutrition.toStringAsFixed(0)}% '), // Углеводы
],
),
],
@@ -329,9 +324,7 @@ class DiaryScreen extends StatelessWidget {
borderRadius: BorderRadiusStyle.roundedBorder5,
),
child: Center(
child: CircularProgressIndicator(
color: appTheme
.blueGray300), // Замените на свой прелоадер при необходимости
child: CircularProgressIndicator(color: appTheme.blueGray300), // Замените на свой прелоадер при необходимости
),
),
],
@@ -355,8 +348,7 @@ class DiaryScreen extends StatelessWidget {
_buildMeal(BuildContext context, DiaryStateLoaded state) {
final digitsOnly = FilteringTextInputFormatter.digitsOnly;
List<String> _options =
state.autocompleteList.map((Product item) => item.name).toList();
List<String> _options = state.autocompleteList.map((Product item) => item.name).toList();
FocusNode focusNodeName = FocusNode();
return Container(
margin: EdgeInsets.symmetric(horizontal: 16.h),
@@ -400,9 +392,7 @@ class DiaryScreen extends StatelessWidget {
onTap: () => _selectMealTime(context, state),
child: AbsorbPointer(
child: CustomTextFormField(
hintText: state.mealTimeController
?.format(context)
.toString(),
hintText: state.mealTimeController?.format(context).toString(),
autofocus: false,
),
),
@@ -538,9 +528,7 @@ class DiaryScreen extends StatelessWidget {
SizedBox(height: 30.v),
_buildAddProduct(context, state),
SizedBox(height: 30.v),
...state.portions
.map((portion) => _buildProduct(context, portion))
.toList(),
...state.portions.map((portion) => _buildProduct(context, portion)).toList(),
SizedBox(height: 30.v),
_buildCarousel(context, state),
SizedBox(height: 20.v),
@@ -689,8 +677,7 @@ class DiaryScreen extends StatelessWidget {
popDialog(BuildContext dialogContext) {
return () {
Navigator.of(dialogContext)
.pop(); // Dismiss the dialog on Cancel button press
Navigator.of(dialogContext).pop(); // Dismiss the dialog on Cancel button press
};
}
@@ -700,8 +687,7 @@ class DiaryScreen extends StatelessWidget {
};
}
selectProduct(AutocompleteOnSelected<String> onSelected, String option,
DiaryStateLoaded state) {
selectProduct(AutocompleteOnSelected<String> onSelected, String option, DiaryStateLoaded state) {
state.product_nameController.text = option;
return () {
onSelected(option);
@@ -769,9 +755,7 @@ class DiaryScreen extends StatelessWidget {
top: 5.v,
),
child: Text(
portion.product_name.length > 8
? portion.product_name.substring(0, 8)
: portion.product_name,
portion.product_name.length > 8 ? portion.product_name.substring(0, 8) : portion.product_name,
style: CustomTextStyles.titleMedium16,
),
),
@@ -843,9 +827,7 @@ class DiaryScreen extends StatelessWidget {
removePhoto(BuildContext context, Photo photo) {
return () {
context
.read<DiaryBloc>()
.add(RemoveImageEvent(photo.id.toString(), photo.path));
context.read<DiaryBloc>().add(RemoveImageEvent(photo.id.toString(), photo.path));
};
}
@@ -923,9 +905,7 @@ class DiaryScreen extends StatelessWidget {
r"Подъем \ отход ко сну",
style: CustomTextStyles.bodyMediumBlack900,
),
Icon(state.wakeupExpanded
? Icons.arrow_drop_up
: Icons.arrow_drop_down),
Icon(state.wakeupExpanded ? Icons.arrow_drop_up : Icons.arrow_drop_down),
],
),
),
@@ -939,8 +919,7 @@ class DiaryScreen extends StatelessWidget {
onTap: () => _selectWakeupTime(context, state),
child: AbsorbPointer(
child: CustomTextFormField(
hintText:
state.wakeupController.format(context).toString(),
hintText: state.wakeupController.format(context).toString(),
prefix: Icon(Icons.sunny),
autofocus: false,
),
@@ -951,8 +930,7 @@ class DiaryScreen extends StatelessWidget {
onTap: () => _selectRetireTime(context, state),
child: AbsorbPointer(
child: CustomTextFormField(
hintText:
state.retireController.format(context).toString(),
hintText: state.retireController.format(context).toString(),
prefix: Icon(Icons.bed),
autofocus: false,
),
@@ -999,8 +977,7 @@ class DiaryScreen extends StatelessWidget {
};
}
Function() sendFinishDayData(
BuildContext dialogContext, BuildContext context) {
Function() sendFinishDayData(BuildContext dialogContext, BuildContext context) {
return () {
closeDialog(dialogContext);
context.read<DiaryBloc>().add(FinishDay());
@@ -1043,9 +1020,7 @@ class DiaryScreen extends StatelessWidget {
"Ваше настроение после приема пищи",
style: CustomTextStyles.bodyMediumBlack900,
),
Icon(state.moodExpanded
? Icons.arrow_drop_up
: Icons.arrow_drop_down),
Icon(state.moodExpanded ? Icons.arrow_drop_up : Icons.arrow_drop_down),
],
),
),
@@ -1105,8 +1080,7 @@ class DiaryScreen extends StatelessWidget {
};
}
Future<void> _selectWakeupTime(
BuildContext context, DiaryStateLoaded state) async {
Future<void> _selectWakeupTime(BuildContext context, DiaryStateLoaded state) async {
final TimeOfDay? pickedTime = await showTimePicker(
context: context,
initialTime: state.wakeupController,
@@ -1116,8 +1090,7 @@ class DiaryScreen extends StatelessWidget {
}
}
Future<void> _selectRetireTime(
BuildContext context, DiaryStateLoaded state) async {
Future<void> _selectRetireTime(BuildContext context, DiaryStateLoaded state) async {
final TimeOfDay? pickedTime = await showTimePicker(
context: context,
initialTime: state.retireController,
@@ -1127,8 +1100,7 @@ class DiaryScreen extends StatelessWidget {
}
}
Future<void> _selectMealTime(
BuildContext context, DiaryStateLoaded state) async {
Future<void> _selectMealTime(BuildContext context, DiaryStateLoaded state) async {
final TimeOfDay? pickedTime = await showTimePicker(
context: context,
initialTime: state.mealTimeController ?? TimeOfDay.now(),
@@ -1139,8 +1111,7 @@ class DiaryScreen extends StatelessWidget {
}
}
bool checkConsumedValues(
List<int> recommendedValues, List<int> consumedValues) {
bool checkConsumedValues(List<int> recommendedValues, List<int> consumedValues) {
for (int i = 0; i < recommendedValues.length; i++) {
if (consumedValues[i] > recommendedValues[i]) {
// Если хотя бы одно потребленное значение превышает рекомендованное