forked from eatvio/eatvio_app
feat(order info): added order info screen
This commit is contained in:
@@ -50,12 +50,12 @@ class _ImageWidgetState extends State<ImageWidget> {
|
||||
createRecipeCubit.replaceImage(null);
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(4),
|
||||
decoration: BoxDecoration(
|
||||
padding: const EdgeInsets.all(4),
|
||||
decoration: const BoxDecoration(
|
||||
color: Colors.white,
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child: Icon(Icons.close_rounded),
|
||||
child: const Icon(Icons.close_rounded),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -78,10 +78,11 @@ class _ImageWidgetState extends State<ImageWidget> {
|
||||
createRecipeCubit.replaceImage(File(image.path));
|
||||
createRecipeCubit.validateImage();
|
||||
}
|
||||
if (!context.mounted) return;
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
child: const Row(
|
||||
children: const [
|
||||
children: [
|
||||
Icon(Icons.photo_camera),
|
||||
SizedBox(width: 8),
|
||||
Text('Фото'),
|
||||
@@ -97,10 +98,11 @@ class _ImageWidgetState extends State<ImageWidget> {
|
||||
createRecipeCubit.replaceImage(File(image.path));
|
||||
createRecipeCubit.validateImage();
|
||||
}
|
||||
if (!context.mounted) return;
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
child: const Row(
|
||||
children: const [
|
||||
children: [
|
||||
Icon(Icons.photo),
|
||||
SizedBox(width: 8),
|
||||
Text('Галерея'),
|
||||
|
||||
@@ -41,8 +41,8 @@ class _InfoAboutRecipeWidgetState extends State<InfoAboutRecipeWidget> {
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text('Название'),
|
||||
SizedBox(height: 4),
|
||||
const Text('Название'),
|
||||
const SizedBox(height: 4),
|
||||
BlocBuilder<CreateRecipeCubit, CreateRecipeState>(
|
||||
buildWhen: (previous, current) => previous.titleValidationError != current.titleValidationError,
|
||||
builder: (context, state) {
|
||||
@@ -59,7 +59,7 @@ class _InfoAboutRecipeWidgetState extends State<InfoAboutRecipeWidget> {
|
||||
},
|
||||
),
|
||||
if (state.titleValidationError != null) ...[
|
||||
SizedBox(height: 4),
|
||||
const SizedBox(height: 4),
|
||||
CustomErrorWidget(
|
||||
error: state.titleValidationError!,
|
||||
),
|
||||
@@ -69,8 +69,8 @@ class _InfoAboutRecipeWidgetState extends State<InfoAboutRecipeWidget> {
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Text('Тип блюда'),
|
||||
SizedBox(height: 4),
|
||||
const Text('Тип блюда'),
|
||||
const SizedBox(height: 4),
|
||||
CustomDropDown(
|
||||
items: items,
|
||||
value: selectedType,
|
||||
@@ -84,14 +84,14 @@ class _InfoAboutRecipeWidgetState extends State<InfoAboutRecipeWidget> {
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
TagsWidget(),
|
||||
const TagsWidget(),
|
||||
const SizedBox(height: 12),
|
||||
PortionWidget(),
|
||||
const PortionWidget(),
|
||||
const SizedBox(height: 12),
|
||||
TimeOfCookWidget(),
|
||||
const TimeOfCookWidget(),
|
||||
const SizedBox(height: 12),
|
||||
Text('Описание'),
|
||||
SizedBox(height: 4),
|
||||
const Text('Описание'),
|
||||
const SizedBox(height: 4),
|
||||
BlocBuilder<CreateRecipeCubit, CreateRecipeState>(
|
||||
buildWhen: (previous, current) => previous.descriptionValidationError != current.descriptionValidationError,
|
||||
builder: (context, state) {
|
||||
@@ -110,7 +110,7 @@ class _InfoAboutRecipeWidgetState extends State<InfoAboutRecipeWidget> {
|
||||
},
|
||||
),
|
||||
if (state.descriptionValidationError != null) ...[
|
||||
SizedBox(height: 4),
|
||||
const SizedBox(height: 4),
|
||||
CustomErrorWidget(
|
||||
error: state.descriptionValidationError!,
|
||||
),
|
||||
@@ -120,21 +120,21 @@ class _InfoAboutRecipeWidgetState extends State<InfoAboutRecipeWidget> {
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Text('Фото обложка'),
|
||||
SizedBox(height: 4),
|
||||
const Text('Фото обложка'),
|
||||
const SizedBox(height: 4),
|
||||
BlocBuilder<CreateRecipeCubit, CreateRecipeState>(
|
||||
buildWhen: (previous, current) => previous.imageValidationError != current.imageValidationError || previous.entity.image != current.entity.image,
|
||||
builder: (context, state) {
|
||||
return Column(
|
||||
children: [
|
||||
Container(
|
||||
child: ImageWidget(image: state.entity.image),
|
||||
decoration: state.imageValidationError != null
|
||||
? BoxDecoration(border: Border.all(width: 1, color: appTheme.red), borderRadius: BorderRadius.circular(8))
|
||||
: null,
|
||||
child: ImageWidget(image: state.entity.image),
|
||||
),
|
||||
if (state.imageValidationError != null) ...[
|
||||
SizedBox(height: 4),
|
||||
const SizedBox(height: 4),
|
||||
CustomErrorWidget(
|
||||
error: state.imageValidationError!,
|
||||
),
|
||||
@@ -144,8 +144,8 @@ class _InfoAboutRecipeWidgetState extends State<InfoAboutRecipeWidget> {
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Text('Ссылка на видео (если есть)'),
|
||||
SizedBox(height: 4),
|
||||
const Text('Ссылка на видео (если есть)'),
|
||||
const SizedBox(height: 4),
|
||||
CustomTextFormField(
|
||||
hintText: 'Прикрепите ссылку на видео',
|
||||
onChanged: (value) {
|
||||
|
||||
@@ -37,8 +37,8 @@ class _IngredientsWidgetState extends State<IngredientsWidget> {
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
const Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 16),
|
||||
child: Text(
|
||||
'Ингредиенты ',
|
||||
style: TextStyle(
|
||||
@@ -62,7 +62,7 @@ class _IngredientsWidgetState extends State<IngredientsWidget> {
|
||||
children: <Widget>[
|
||||
for (int index = 0; index < state.entity.ingredients.length; index += 1)
|
||||
ListTile(
|
||||
contentPadding: EdgeInsets.symmetric(horizontal: 16),
|
||||
contentPadding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
key: Key('$index'),
|
||||
leading: Icon(
|
||||
Icons.drag_handle_rounded,
|
||||
@@ -90,7 +90,7 @@ class _IngredientsWidgetState extends State<IngredientsWidget> {
|
||||
showModalBottomSheet(
|
||||
useRootNavigator: true,
|
||||
context: context,
|
||||
shape: RoundedRectangleBorder(
|
||||
shape: const RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.vertical(top: Radius.circular(12)),
|
||||
),
|
||||
isScrollControlled: true,
|
||||
@@ -106,7 +106,7 @@ class _IngredientsWidgetState extends State<IngredientsWidget> {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(
|
||||
const Text(
|
||||
'Добавление ингредиента',
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
@@ -179,7 +179,7 @@ class _IngredientsWidgetState extends State<IngredientsWidget> {
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
color: appTheme.blueA400,
|
||||
),
|
||||
child: Center(
|
||||
child: const Center(
|
||||
child: Text(
|
||||
'Добавить',
|
||||
style: TextStyle(
|
||||
|
||||
@@ -38,8 +38,8 @@ class _PortionWidgetState extends State<PortionWidget> {
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text('Кол-во порций'),
|
||||
SizedBox(height: 4),
|
||||
const Text('Кол-во порций'),
|
||||
const SizedBox(height: 4),
|
||||
Column(
|
||||
children: [
|
||||
CustomTextFormField(
|
||||
@@ -54,7 +54,7 @@ class _PortionWidgetState extends State<PortionWidget> {
|
||||
},
|
||||
),
|
||||
if (state.servingsValidationError != null) ...[
|
||||
SizedBox(height: 4),
|
||||
const SizedBox(height: 4),
|
||||
CustomErrorWidget(
|
||||
error: state.servingsValidationError!,
|
||||
),
|
||||
@@ -70,15 +70,15 @@ class _PortionWidgetState extends State<PortionWidget> {
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text('Ккал в одной порции'),
|
||||
SizedBox(height: 4),
|
||||
const Text('Ккал в одной порции'),
|
||||
const SizedBox(height: 4),
|
||||
Column(
|
||||
children: [
|
||||
CustomTextFormField(
|
||||
hintText: '100',
|
||||
hasError: state.energyPerServingValidationError != null,
|
||||
suffixText: 'Ккал',
|
||||
textInputType: TextInputType.numberWithOptions(decimal: true),
|
||||
textInputType: const TextInputType.numberWithOptions(decimal: true),
|
||||
onChanged: (value) {
|
||||
createRecipeCubit.replaceEnegryInPortion(double.parse(value));
|
||||
if (state.energyPerServingValidationError != null) {
|
||||
@@ -87,7 +87,7 @@ class _PortionWidgetState extends State<PortionWidget> {
|
||||
},
|
||||
),
|
||||
if (state.energyPerServingValidationError != null) ...[
|
||||
SizedBox(height: 4),
|
||||
const SizedBox(height: 4),
|
||||
CustomErrorWidget(
|
||||
error: state.energyPerServingValidationError!,
|
||||
),
|
||||
|
||||
@@ -59,12 +59,12 @@ class _StepImageWidgetState extends State<StepImageWidget> {
|
||||
createRecipeCubit.replaceImageInStep(null, widget.index);
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(4),
|
||||
decoration: BoxDecoration(
|
||||
padding: const EdgeInsets.all(4),
|
||||
decoration: const BoxDecoration(
|
||||
color: Colors.white,
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child: Icon(Icons.close_rounded),
|
||||
child: const Icon(Icons.close_rounded),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -86,10 +86,11 @@ class _StepImageWidgetState extends State<StepImageWidget> {
|
||||
if (image != null) {
|
||||
createRecipeCubit.replaceImageInStep(File(image!.path), widget.index);
|
||||
}
|
||||
if (!context.mounted) return;
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
child: const Row(
|
||||
children: const [
|
||||
children: [
|
||||
Icon(Icons.photo_camera),
|
||||
SizedBox(width: 8),
|
||||
Text('Фото'),
|
||||
@@ -104,10 +105,11 @@ class _StepImageWidgetState extends State<StepImageWidget> {
|
||||
if (image != null) {
|
||||
createRecipeCubit.replaceImageInStep(File(image!.path), widget.index);
|
||||
}
|
||||
if (!context.mounted) return;
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
child: const Row(
|
||||
children: const [
|
||||
children: [
|
||||
Icon(Icons.photo),
|
||||
SizedBox(width: 8),
|
||||
Text('Галерея'),
|
||||
|
||||
@@ -35,7 +35,7 @@ class _StepsWidgetState extends State<StepsWidget> {
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
const Text(
|
||||
'Пошаговая инструкция',
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
@@ -54,7 +54,7 @@ class _StepsWidgetState extends State<StepsWidget> {
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Container(
|
||||
padding: EdgeInsets.symmetric(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 12,
|
||||
vertical: 4,
|
||||
),
|
||||
@@ -64,7 +64,7 @@ class _StepsWidgetState extends State<StepsWidget> {
|
||||
),
|
||||
child: Text(
|
||||
'Шаг ${index + 1}',
|
||||
style: TextStyle(
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
@@ -74,13 +74,13 @@ class _StepsWidgetState extends State<StepsWidget> {
|
||||
onTap: () {
|
||||
context.read<CreateRecipeCubit>().removeStep(state.entity.steps[index]);
|
||||
},
|
||||
child: Icon(Icons.delete_outline_rounded),
|
||||
child: const Icon(Icons.delete_outline_rounded),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Text('Описание'),
|
||||
SizedBox(height: 4),
|
||||
const Text('Описание'),
|
||||
const SizedBox(height: 4),
|
||||
CustomTextFormField(
|
||||
hintText: 'Например: подготовьте ингредиенты',
|
||||
maxLines: 5,
|
||||
@@ -90,8 +90,8 @@ class _StepsWidgetState extends State<StepsWidget> {
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Text('Фото шага'),
|
||||
SizedBox(height: 4),
|
||||
const Text('Фото шага'),
|
||||
const SizedBox(height: 4),
|
||||
StepImageWidget(
|
||||
index: index,
|
||||
),
|
||||
@@ -114,7 +114,7 @@ class _StepsWidgetState extends State<StepsWidget> {
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
child: const Text(
|
||||
'Добавить шаг',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
|
||||
@@ -18,8 +18,8 @@ class _TagsWidgetState extends State<TagsWidget> {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text('Теги'),
|
||||
SizedBox(height: 4),
|
||||
const Text('Теги'),
|
||||
const SizedBox(height: 4),
|
||||
CustomTextFormField(
|
||||
hintText: 'Например: без майонеза',
|
||||
controller: tagController,
|
||||
@@ -52,7 +52,7 @@ class _TagsWidgetState extends State<TagsWidget> {
|
||||
},
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
child: Ink(
|
||||
padding: EdgeInsets.symmetric(vertical: 4, horizontal: 12),
|
||||
padding: const EdgeInsets.symmetric(vertical: 4, horizontal: 12),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
color: Colors.grey.shade200,
|
||||
|
||||
@@ -34,13 +34,13 @@ class _TimeOfCookWidgetState extends State<TimeOfCookWidget> {
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Text('Общее время приготовления'),
|
||||
const Text('Общее время приготовления'),
|
||||
const SizedBox(width: 8),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
builder: (context) => const AlertDialog(
|
||||
content: Text(
|
||||
'Общее время приготовления - это период времени от начала приготовления блюда до подачи его на стол.',
|
||||
style: TextStyle(
|
||||
@@ -60,7 +60,7 @@ class _TimeOfCookWidgetState extends State<TimeOfCookWidget> {
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 4),
|
||||
const SizedBox(height: 4),
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
@@ -81,7 +81,7 @@ class _TimeOfCookWidgetState extends State<TimeOfCookWidget> {
|
||||
},
|
||||
),
|
||||
if (state.cookingTimeValidationError != null) ...[
|
||||
SizedBox(height: 4),
|
||||
const SizedBox(height: 4),
|
||||
CustomErrorWidget(
|
||||
error: state.cookingTimeValidationError!,
|
||||
),
|
||||
@@ -107,7 +107,7 @@ class _TimeOfCookWidgetState extends State<TimeOfCookWidget> {
|
||||
},
|
||||
),
|
||||
if (state.cookingTimeValidationError != null) ...[
|
||||
SizedBox(height: 4),
|
||||
const SizedBox(height: 4),
|
||||
CustomErrorWidget(
|
||||
error: state.cookingTimeValidationError!,
|
||||
),
|
||||
@@ -120,13 +120,13 @@ class _TimeOfCookWidgetState extends State<TimeOfCookWidget> {
|
||||
const SizedBox(height: 12),
|
||||
Row(
|
||||
children: [
|
||||
Text('Активное время приготовления'),
|
||||
const Text('Активное время приготовления'),
|
||||
const SizedBox(width: 8),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
builder: (context) => const AlertDialog(
|
||||
content: Text(
|
||||
'Активное время приготовления - это период времени, требующий активного участия в приготовлении блюда. Оно включает мытье и очистку продуктов, нарезку, шинковку, взбивание, перемешивание, размешивание, перекладывание и т.п.',
|
||||
style: TextStyle(
|
||||
@@ -146,7 +146,7 @@ class _TimeOfCookWidgetState extends State<TimeOfCookWidget> {
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 4),
|
||||
const SizedBox(height: 4),
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
@@ -168,7 +168,7 @@ class _TimeOfCookWidgetState extends State<TimeOfCookWidget> {
|
||||
},
|
||||
),
|
||||
if (state.activeTimeValidationError != null) ...[
|
||||
SizedBox(height: 4),
|
||||
const SizedBox(height: 4),
|
||||
CustomErrorWidget(
|
||||
error: state.activeTimeValidationError!,
|
||||
),
|
||||
@@ -195,7 +195,7 @@ class _TimeOfCookWidgetState extends State<TimeOfCookWidget> {
|
||||
},
|
||||
),
|
||||
if (state.activeTimeValidationError != null) ...[
|
||||
SizedBox(height: 4),
|
||||
const SizedBox(height: 4),
|
||||
CustomErrorWidget(
|
||||
error: state.activeTimeValidationError!,
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user