forked from eatvio/eatvio_app
feat(order info): added order info screen
This commit is contained in:
@@ -11,9 +11,9 @@ class CreateRecipeCubit extends Cubit<CreateRecipeState> {
|
||||
final RecipeRepository recipeRepository;
|
||||
CreateRecipeCubit({required this.recipeRepository})
|
||||
: super(
|
||||
CreateRecipeState(
|
||||
const CreateRecipeState(
|
||||
entity: RecipeCreateEntity(
|
||||
typeOfRecipe: TypeOfRecipe.first_meals,
|
||||
typeOfRecipe: TypeOfRecipe.firstMeals,
|
||||
ingredients: [],
|
||||
steps: [StepEntity()],
|
||||
tags: [],
|
||||
@@ -26,7 +26,7 @@ class CreateRecipeCubit extends Cubit<CreateRecipeState> {
|
||||
state.copyWith.entity(
|
||||
steps: [
|
||||
...state.entity.steps,
|
||||
StepEntity(),
|
||||
const StepEntity(),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
@@ -12,8 +12,7 @@ part of 'create_recipe_state.dart';
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
final _privateConstructorUsedError = UnsupportedError(
|
||||
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models',
|
||||
);
|
||||
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
|
||||
|
||||
/// @nodoc
|
||||
mixin _$CreateRecipeState {
|
||||
@@ -37,20 +36,18 @@ mixin _$CreateRecipeState {
|
||||
/// @nodoc
|
||||
abstract class $CreateRecipeStateCopyWith<$Res> {
|
||||
factory $CreateRecipeStateCopyWith(
|
||||
CreateRecipeState value,
|
||||
$Res Function(CreateRecipeState) then,
|
||||
) = _$CreateRecipeStateCopyWithImpl<$Res, CreateRecipeState>;
|
||||
CreateRecipeState value, $Res Function(CreateRecipeState) then) =
|
||||
_$CreateRecipeStateCopyWithImpl<$Res, CreateRecipeState>;
|
||||
@useResult
|
||||
$Res call({
|
||||
RecipeCreateEntity entity,
|
||||
String? titleValidationError,
|
||||
String? descriptionValidationError,
|
||||
String? cookingTimeValidationError,
|
||||
String? activeTimeValidationError,
|
||||
String? servingsValidationError,
|
||||
String? energyPerServingValidationError,
|
||||
String? imageValidationError,
|
||||
});
|
||||
$Res call(
|
||||
{RecipeCreateEntity entity,
|
||||
String? titleValidationError,
|
||||
String? descriptionValidationError,
|
||||
String? cookingTimeValidationError,
|
||||
String? activeTimeValidationError,
|
||||
String? servingsValidationError,
|
||||
String? energyPerServingValidationError,
|
||||
String? imageValidationError});
|
||||
|
||||
$RecipeCreateEntityCopyWith<$Res> get entity;
|
||||
}
|
||||
@@ -79,51 +76,41 @@ class _$CreateRecipeStateCopyWithImpl<$Res, $Val extends CreateRecipeState>
|
||||
Object? energyPerServingValidationError = freezed,
|
||||
Object? imageValidationError = freezed,
|
||||
}) {
|
||||
return _then(
|
||||
_value.copyWith(
|
||||
entity:
|
||||
null == entity
|
||||
? _value.entity
|
||||
: entity // ignore: cast_nullable_to_non_nullable
|
||||
as RecipeCreateEntity,
|
||||
titleValidationError:
|
||||
freezed == titleValidationError
|
||||
? _value.titleValidationError
|
||||
: titleValidationError // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
descriptionValidationError:
|
||||
freezed == descriptionValidationError
|
||||
? _value.descriptionValidationError
|
||||
: descriptionValidationError // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
cookingTimeValidationError:
|
||||
freezed == cookingTimeValidationError
|
||||
? _value.cookingTimeValidationError
|
||||
: cookingTimeValidationError // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
activeTimeValidationError:
|
||||
freezed == activeTimeValidationError
|
||||
? _value.activeTimeValidationError
|
||||
: activeTimeValidationError // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
servingsValidationError:
|
||||
freezed == servingsValidationError
|
||||
? _value.servingsValidationError
|
||||
: servingsValidationError // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
energyPerServingValidationError:
|
||||
freezed == energyPerServingValidationError
|
||||
? _value.energyPerServingValidationError
|
||||
: energyPerServingValidationError // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
imageValidationError:
|
||||
freezed == imageValidationError
|
||||
? _value.imageValidationError
|
||||
: imageValidationError // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
)
|
||||
as $Val,
|
||||
);
|
||||
return _then(_value.copyWith(
|
||||
entity: null == entity
|
||||
? _value.entity
|
||||
: entity // ignore: cast_nullable_to_non_nullable
|
||||
as RecipeCreateEntity,
|
||||
titleValidationError: freezed == titleValidationError
|
||||
? _value.titleValidationError
|
||||
: titleValidationError // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
descriptionValidationError: freezed == descriptionValidationError
|
||||
? _value.descriptionValidationError
|
||||
: descriptionValidationError // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
cookingTimeValidationError: freezed == cookingTimeValidationError
|
||||
? _value.cookingTimeValidationError
|
||||
: cookingTimeValidationError // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
activeTimeValidationError: freezed == activeTimeValidationError
|
||||
? _value.activeTimeValidationError
|
||||
: activeTimeValidationError // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
servingsValidationError: freezed == servingsValidationError
|
||||
? _value.servingsValidationError
|
||||
: servingsValidationError // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
energyPerServingValidationError: freezed ==
|
||||
energyPerServingValidationError
|
||||
? _value.energyPerServingValidationError
|
||||
: energyPerServingValidationError // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
imageValidationError: freezed == imageValidationError
|
||||
? _value.imageValidationError
|
||||
: imageValidationError // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
) as $Val);
|
||||
}
|
||||
|
||||
/// Create a copy of CreateRecipeState
|
||||
@@ -140,22 +127,20 @@ class _$CreateRecipeStateCopyWithImpl<$Res, $Val extends CreateRecipeState>
|
||||
/// @nodoc
|
||||
abstract class _$$CreateRecipeStateImplCopyWith<$Res>
|
||||
implements $CreateRecipeStateCopyWith<$Res> {
|
||||
factory _$$CreateRecipeStateImplCopyWith(
|
||||
_$CreateRecipeStateImpl value,
|
||||
$Res Function(_$CreateRecipeStateImpl) then,
|
||||
) = __$$CreateRecipeStateImplCopyWithImpl<$Res>;
|
||||
factory _$$CreateRecipeStateImplCopyWith(_$CreateRecipeStateImpl value,
|
||||
$Res Function(_$CreateRecipeStateImpl) then) =
|
||||
__$$CreateRecipeStateImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call({
|
||||
RecipeCreateEntity entity,
|
||||
String? titleValidationError,
|
||||
String? descriptionValidationError,
|
||||
String? cookingTimeValidationError,
|
||||
String? activeTimeValidationError,
|
||||
String? servingsValidationError,
|
||||
String? energyPerServingValidationError,
|
||||
String? imageValidationError,
|
||||
});
|
||||
$Res call(
|
||||
{RecipeCreateEntity entity,
|
||||
String? titleValidationError,
|
||||
String? descriptionValidationError,
|
||||
String? cookingTimeValidationError,
|
||||
String? activeTimeValidationError,
|
||||
String? servingsValidationError,
|
||||
String? energyPerServingValidationError,
|
||||
String? imageValidationError});
|
||||
|
||||
@override
|
||||
$RecipeCreateEntityCopyWith<$Res> get entity;
|
||||
@@ -165,10 +150,9 @@ abstract class _$$CreateRecipeStateImplCopyWith<$Res>
|
||||
class __$$CreateRecipeStateImplCopyWithImpl<$Res>
|
||||
extends _$CreateRecipeStateCopyWithImpl<$Res, _$CreateRecipeStateImpl>
|
||||
implements _$$CreateRecipeStateImplCopyWith<$Res> {
|
||||
__$$CreateRecipeStateImplCopyWithImpl(
|
||||
_$CreateRecipeStateImpl _value,
|
||||
$Res Function(_$CreateRecipeStateImpl) _then,
|
||||
) : super(_value, _then);
|
||||
__$$CreateRecipeStateImplCopyWithImpl(_$CreateRecipeStateImpl _value,
|
||||
$Res Function(_$CreateRecipeStateImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of CreateRecipeState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@@ -184,66 +168,56 @@ class __$$CreateRecipeStateImplCopyWithImpl<$Res>
|
||||
Object? energyPerServingValidationError = freezed,
|
||||
Object? imageValidationError = freezed,
|
||||
}) {
|
||||
return _then(
|
||||
_$CreateRecipeStateImpl(
|
||||
entity:
|
||||
null == entity
|
||||
? _value.entity
|
||||
: entity // ignore: cast_nullable_to_non_nullable
|
||||
as RecipeCreateEntity,
|
||||
titleValidationError:
|
||||
freezed == titleValidationError
|
||||
? _value.titleValidationError
|
||||
: titleValidationError // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
descriptionValidationError:
|
||||
freezed == descriptionValidationError
|
||||
? _value.descriptionValidationError
|
||||
: descriptionValidationError // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
cookingTimeValidationError:
|
||||
freezed == cookingTimeValidationError
|
||||
? _value.cookingTimeValidationError
|
||||
: cookingTimeValidationError // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
activeTimeValidationError:
|
||||
freezed == activeTimeValidationError
|
||||
? _value.activeTimeValidationError
|
||||
: activeTimeValidationError // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
servingsValidationError:
|
||||
freezed == servingsValidationError
|
||||
? _value.servingsValidationError
|
||||
: servingsValidationError // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
energyPerServingValidationError:
|
||||
freezed == energyPerServingValidationError
|
||||
? _value.energyPerServingValidationError
|
||||
: energyPerServingValidationError // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
imageValidationError:
|
||||
freezed == imageValidationError
|
||||
? _value.imageValidationError
|
||||
: imageValidationError // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
),
|
||||
);
|
||||
return _then(_$CreateRecipeStateImpl(
|
||||
entity: null == entity
|
||||
? _value.entity
|
||||
: entity // ignore: cast_nullable_to_non_nullable
|
||||
as RecipeCreateEntity,
|
||||
titleValidationError: freezed == titleValidationError
|
||||
? _value.titleValidationError
|
||||
: titleValidationError // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
descriptionValidationError: freezed == descriptionValidationError
|
||||
? _value.descriptionValidationError
|
||||
: descriptionValidationError // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
cookingTimeValidationError: freezed == cookingTimeValidationError
|
||||
? _value.cookingTimeValidationError
|
||||
: cookingTimeValidationError // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
activeTimeValidationError: freezed == activeTimeValidationError
|
||||
? _value.activeTimeValidationError
|
||||
: activeTimeValidationError // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
servingsValidationError: freezed == servingsValidationError
|
||||
? _value.servingsValidationError
|
||||
: servingsValidationError // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
energyPerServingValidationError: freezed ==
|
||||
energyPerServingValidationError
|
||||
? _value.energyPerServingValidationError
|
||||
: energyPerServingValidationError // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
imageValidationError: freezed == imageValidationError
|
||||
? _value.imageValidationError
|
||||
: imageValidationError // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$CreateRecipeStateImpl implements _CreateRecipeState {
|
||||
const _$CreateRecipeStateImpl({
|
||||
required this.entity,
|
||||
this.titleValidationError,
|
||||
this.descriptionValidationError,
|
||||
this.cookingTimeValidationError,
|
||||
this.activeTimeValidationError,
|
||||
this.servingsValidationError,
|
||||
this.energyPerServingValidationError,
|
||||
this.imageValidationError,
|
||||
});
|
||||
const _$CreateRecipeStateImpl(
|
||||
{required this.entity,
|
||||
this.titleValidationError,
|
||||
this.descriptionValidationError,
|
||||
this.cookingTimeValidationError,
|
||||
this.activeTimeValidationError,
|
||||
this.servingsValidationError,
|
||||
this.energyPerServingValidationError,
|
||||
this.imageValidationError});
|
||||
|
||||
@override
|
||||
final RecipeCreateEntity entity;
|
||||
@@ -275,32 +249,22 @@ class _$CreateRecipeStateImpl implements _CreateRecipeState {
|
||||
(identical(other.entity, entity) || other.entity == entity) &&
|
||||
(identical(other.titleValidationError, titleValidationError) ||
|
||||
other.titleValidationError == titleValidationError) &&
|
||||
(identical(
|
||||
other.descriptionValidationError,
|
||||
descriptionValidationError,
|
||||
) ||
|
||||
(identical(other.descriptionValidationError,
|
||||
descriptionValidationError) ||
|
||||
other.descriptionValidationError ==
|
||||
descriptionValidationError) &&
|
||||
(identical(
|
||||
other.cookingTimeValidationError,
|
||||
cookingTimeValidationError,
|
||||
) ||
|
||||
(identical(other.cookingTimeValidationError,
|
||||
cookingTimeValidationError) ||
|
||||
other.cookingTimeValidationError ==
|
||||
cookingTimeValidationError) &&
|
||||
(identical(
|
||||
other.activeTimeValidationError,
|
||||
activeTimeValidationError,
|
||||
) ||
|
||||
(identical(other.activeTimeValidationError,
|
||||
activeTimeValidationError) ||
|
||||
other.activeTimeValidationError == activeTimeValidationError) &&
|
||||
(identical(
|
||||
other.servingsValidationError,
|
||||
servingsValidationError,
|
||||
) ||
|
||||
other.servingsValidationError, servingsValidationError) ||
|
||||
other.servingsValidationError == servingsValidationError) &&
|
||||
(identical(
|
||||
other.energyPerServingValidationError,
|
||||
energyPerServingValidationError,
|
||||
) ||
|
||||
(identical(other.energyPerServingValidationError,
|
||||
energyPerServingValidationError) ||
|
||||
other.energyPerServingValidationError ==
|
||||
energyPerServingValidationError) &&
|
||||
(identical(other.imageValidationError, imageValidationError) ||
|
||||
@@ -309,16 +273,15 @@ class _$CreateRecipeStateImpl implements _CreateRecipeState {
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(
|
||||
runtimeType,
|
||||
entity,
|
||||
titleValidationError,
|
||||
descriptionValidationError,
|
||||
cookingTimeValidationError,
|
||||
activeTimeValidationError,
|
||||
servingsValidationError,
|
||||
energyPerServingValidationError,
|
||||
imageValidationError,
|
||||
);
|
||||
runtimeType,
|
||||
entity,
|
||||
titleValidationError,
|
||||
descriptionValidationError,
|
||||
cookingTimeValidationError,
|
||||
activeTimeValidationError,
|
||||
servingsValidationError,
|
||||
energyPerServingValidationError,
|
||||
imageValidationError);
|
||||
|
||||
/// Create a copy of CreateRecipeState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@@ -327,22 +290,19 @@ class _$CreateRecipeStateImpl implements _CreateRecipeState {
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$CreateRecipeStateImplCopyWith<_$CreateRecipeStateImpl> get copyWith =>
|
||||
__$$CreateRecipeStateImplCopyWithImpl<_$CreateRecipeStateImpl>(
|
||||
this,
|
||||
_$identity,
|
||||
);
|
||||
this, _$identity);
|
||||
}
|
||||
|
||||
abstract class _CreateRecipeState implements CreateRecipeState {
|
||||
const factory _CreateRecipeState({
|
||||
required final RecipeCreateEntity entity,
|
||||
final String? titleValidationError,
|
||||
final String? descriptionValidationError,
|
||||
final String? cookingTimeValidationError,
|
||||
final String? activeTimeValidationError,
|
||||
final String? servingsValidationError,
|
||||
final String? energyPerServingValidationError,
|
||||
final String? imageValidationError,
|
||||
}) = _$CreateRecipeStateImpl;
|
||||
const factory _CreateRecipeState(
|
||||
{required final RecipeCreateEntity entity,
|
||||
final String? titleValidationError,
|
||||
final String? descriptionValidationError,
|
||||
final String? cookingTimeValidationError,
|
||||
final String? activeTimeValidationError,
|
||||
final String? servingsValidationError,
|
||||
final String? energyPerServingValidationError,
|
||||
final String? imageValidationError}) = _$CreateRecipeStateImpl;
|
||||
|
||||
@override
|
||||
RecipeCreateEntity get entity;
|
||||
|
||||
@@ -30,11 +30,11 @@ class _RecipeCreateScreenState extends State<RecipeCreateScreen> {
|
||||
return BlocProvider<CreateRecipeCubit>(
|
||||
create: (BuildContext context) => sl<CreateRecipeCubit>(),
|
||||
child: Scaffold(
|
||||
backgroundColor: Color(0xFFF0F2F5),
|
||||
backgroundColor: const Color(0xFFF0F2F5),
|
||||
appBar: AppBar(
|
||||
title: Text('Добавление рецепта'),
|
||||
title: const Text('Добавление рецепта'),
|
||||
centerTitle: true,
|
||||
shape: RoundedRectangleBorder(
|
||||
shape: const RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.vertical(
|
||||
bottom: Radius.circular(12),
|
||||
),
|
||||
@@ -42,13 +42,13 @@ class _RecipeCreateScreenState extends State<RecipeCreateScreen> {
|
||||
),
|
||||
body: SingleChildScrollView(
|
||||
physics: const BouncingScrollPhysics(),
|
||||
padding: EdgeInsets.only(top: 8, bottom: 32),
|
||||
padding: const EdgeInsets.only(top: 8, bottom: 32),
|
||||
child: Column(
|
||||
spacing: 16,
|
||||
children: [
|
||||
InfoAboutRecipeWidget(),
|
||||
IngredientsWidget(),
|
||||
StepsWidget(),
|
||||
const InfoAboutRecipeWidget(),
|
||||
const IngredientsWidget(),
|
||||
const StepsWidget(),
|
||||
BlocBuilder<CreateRecipeCubit, CreateRecipeState>(
|
||||
builder: (context, state) {
|
||||
return Builder(
|
||||
@@ -58,7 +58,8 @@ class _RecipeCreateScreenState extends State<RecipeCreateScreen> {
|
||||
if (context.read<CreateRecipeCubit>().validateAll()) {
|
||||
final isSuccess = await context.read<CreateRecipeCubit>().publishRecipe();
|
||||
if (isSuccess) {
|
||||
Future.delayed(Duration(milliseconds: 500), () {
|
||||
Future.delayed(const Duration(milliseconds: 500), () {
|
||||
if (!context.mounted) return;
|
||||
context.pop();
|
||||
showBottomSheetWithBlur(
|
||||
userRootNavigator: true,
|
||||
@@ -69,6 +70,7 @@ class _RecipeCreateScreenState extends State<RecipeCreateScreen> {
|
||||
);
|
||||
});
|
||||
} else {
|
||||
if (!context.mounted) return;
|
||||
showErrorDialog(context, title: '${s.could_not_publish_recipe} ${state.entity.title}');
|
||||
}
|
||||
}
|
||||
@@ -83,7 +85,7 @@ class _RecipeCreateScreenState extends State<RecipeCreateScreen> {
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
child: const Text(
|
||||
'Опубликовать',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
|
||||
@@ -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