fix(blog posts, diets, plans, recipies): changed name of json field for descriptions of models

This commit is contained in:
Username1548
2025-03-28 20:36:09 +07:00
parent 7008276735
commit f9741adf1e
24 changed files with 134 additions and 208 deletions

View File

@@ -67,9 +67,7 @@ class _AboutRecipeScreenState extends State<AboutRecipeScreen> {
void _scrollToBottom() {
_jumped = true;
scrollController.jumpTo(
scrollController.position.maxScrollExtent,
);
scrollController.jumpTo(scrollController.position.maxScrollExtent);
}
@override
@@ -78,12 +76,7 @@ class _AboutRecipeScreenState extends State<AboutRecipeScreen> {
return BlocProvider(
create: (context) => recipeCubit..getRecipe(widget.recipe.slug),
child: BlocProvider<CommentsCubit>(
create: (BuildContext context) => commentsCubit
..getComments(
widget.recipe.slug.toString(),
CommentSourceType.recipe,
true,
),
create: (BuildContext context) => commentsCubit..getComments(widget.recipe.slug.toString(), CommentSourceType.recipe, true),
child: BlocConsumer<CommentsCubit, CommentsState>(
listener: (BuildContext context, CommentsState commentsState) {
if (commentsState is CommentsStateLoaded) {
@@ -106,14 +99,7 @@ class _AboutRecipeScreenState extends State<AboutRecipeScreen> {
resizeToAvoidBottomInset: true,
bottomSheet: Container(
padding: EdgeInsets.symmetric(vertical: 12) + (Platform.isIOS ? const EdgeInsets.only(bottom: 16) : EdgeInsets.zero),
decoration: BoxDecoration(
color: Colors.white,
border: Border(
top: BorderSide(
color: Colors.black.withValues(alpha: 0.1),
),
),
),
decoration: BoxDecoration(color: Colors.white, border: Border(top: BorderSide(color: Colors.black.withValues(alpha: 0.1)))),
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: Column(
@@ -133,17 +119,10 @@ class _AboutRecipeScreenState extends State<AboutRecipeScreen> {
FocusManager.instance.primaryFocus?.unfocus();
},
child: Container(
decoration: BoxDecoration(
color: appTheme.blueA400,
shape: BoxShape.circle,
),
decoration: BoxDecoration(color: appTheme.blueA400, shape: BoxShape.circle),
height: 32,
width: 32,
child: Icon(
Icons.close_rounded,
size: 18,
color: Colors.white,
),
child: Icon(Icons.close_rounded, size: 18, color: Colors.white),
),
),
if (replyId != null) SizedBox(width: 8),
@@ -159,22 +138,12 @@ class _AboutRecipeScreenState extends State<AboutRecipeScreen> {
maxLines: 5,
minLines: 1,
keyboardType: TextInputType.multiline,
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w400,
color: Colors.black,
height: 1.2,
),
style: TextStyle(fontSize: 16, fontWeight: FontWeight.w400, color: Colors.black, height: 1.2),
decoration: InputDecoration(
isDense: false, // убираем true, чтобы padding учитывался корректно
contentPadding: EdgeInsets.symmetric(horizontal: 16, vertical: 16), // вертикальный паддинг увеличен
hintText: 'Комментарий',
hintStyle: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w400,
height: 1.2,
color: Color(0xFFAEAEB2),
),
hintStyle: TextStyle(fontSize: 16, fontWeight: FontWeight.w400, height: 1.2, color: Color(0xFFAEAEB2)),
filled: true,
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(16),
@@ -214,7 +183,10 @@ class _AboutRecipeScreenState extends State<AboutRecipeScreen> {
}
},
child: Container(
decoration: BoxDecoration(color: textEditingController.text.length > 2 ? appTheme.blueA400 : Colors.grey, shape: BoxShape.circle),
decoration: BoxDecoration(
color: textEditingController.text.length > 2 ? appTheme.blueA400 : Colors.grey,
shape: BoxShape.circle,
),
height: 32,
width: 32,
child: Icon(Icons.send_rounded, size: 18, color: Colors.white),
@@ -244,22 +216,14 @@ class _AboutRecipeScreenState extends State<AboutRecipeScreen> {
path: 'recipe/${widget.recipe.slug}',
slug: widget.recipe.slug,
),
anchor: Aligned(
shiftToWithinBound: AxisFlag(x: true, y: true),
follower: Alignment.topRight,
target: Alignment.bottomRight,
),
anchor: Aligned(shiftToWithinBound: AxisFlag(x: true, y: true), follower: Alignment.topRight, target: Alignment.bottomRight),
child: IconButton(
onPressed: () {
setState(() {
isMoreOptionsVisible = !isMoreOptionsVisible;
});
},
icon: SvgPicture.asset(
'assets/icons/more_button.svg',
width: 20,
height: 20,
),
icon: SvgPicture.asset('assets/icons/more_button.svg', width: 20, height: 20),
),
),
],
@@ -294,10 +258,7 @@ class _AboutRecipeScreenState extends State<AboutRecipeScreen> {
children: [
SvgPicture.asset('assets/icons/eye.svg', width: 18, height: 12),
SizedBox(width: 8),
Text(
widget.recipe.viewsCount.toString(),
style: TextStyles.textXSSemibold.copyWith(color: appTheme.black),
),
Text(widget.recipe.viewsCount.toString(), style: TextStyles.textXSSemibold.copyWith(color: appTheme.black)),
],
backgroundColor: appTheme.whiteA700,
),
@@ -361,17 +322,11 @@ class _AboutRecipeScreenState extends State<AboutRecipeScreen> {
SizedBox(height: 16),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: Text(
s.about_recipe,
style: TextStyles.headingXLSemibold.copyWith(color: appTheme.black),
),
child: Text(s.about_recipe, style: TextStyles.headingXLSemibold.copyWith(color: appTheme.black)),
),
SizedBox(height: 12),
InfoRow(
recipe: widget.recipe,
type: ProductType.recipe,
),
if (widget.recipe.videoUrl != null)
InfoRow(recipe: widget.recipe, type: ProductType.recipe),
if (widget.recipe.videoUrl != null && widget.recipe.videoUrl!.isNotEmpty)
Padding(
padding: const EdgeInsets.only(left: 16, bottom: 12, top: 12),
child: GestureDetector(
@@ -389,44 +344,26 @@ class _AboutRecipeScreenState extends State<AboutRecipeScreen> {
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Text(
s.check_out_video_recipe,
style: TextStyles.textMSemibold.copyWith(
color: appTheme.black,
),
),
Text(s.check_out_video_recipe, style: TextStyles.textMSemibold.copyWith(color: appTheme.black)),
SizedBox(width: 12),
SvgPicture.asset('assets/icons/play_icon.svg', width: 16, height: 16),
],
),
),
),
ExpandableText(
text: widget.recipe.description,
),
ExpandableText(text: widget.recipe.description),
SizedBox(height: 20),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: AuthorCard(
author: widget.recipe.author,
title: s.recipe_author,
),
child: AuthorCard(author: widget.recipe.author, title: s.recipe_author),
),
SizedBox(height: 16),
],
),
),
SizedBox(height: 12),
if (widget.recipe.ingredients?.isNotEmpty == true)
IngredientsWidget(
recipe: widget.recipe,
),
if (widget.recipe.steps?.isNotEmpty == true) ...[
SizedBox(height: 12),
StepsWidget(
recipe: widget.recipe,
),
],
if (widget.recipe.ingredients?.isNotEmpty == true) IngredientsWidget(recipe: widget.recipe),
if (widget.recipe.steps?.isNotEmpty == true) ...[SizedBox(height: 12), StepsWidget(recipe: widget.recipe)],
SizedBox(height: 8),
MainBackgroundBouble(
padding: EdgeInsets.symmetric(vertical: 16),
@@ -437,20 +374,13 @@ class _AboutRecipeScreenState extends State<AboutRecipeScreen> {
alignment: Alignment.centerLeft,
child: Text(
recipeState.recipe.commentsCount.toString() + ' ' + getCommentForm(widget.recipe.commentsCount, s),
style: TextStyles.textMMedium.copyWith(
color: appTheme.gray500,
),
style: TextStyles.textMMedium.copyWith(color: appTheme.gray500),
),
),
SizedBox(height: 16),
if (state is CommentsStateLoading) const Loader(),
if (state is CommentsStateLoaded)
CommentsWidget(
id: widget.recipe.slug,
commentSourceType: CommentSourceType.recipe,
comment: state.comment,
replyId: replyId,
),
CommentsWidget(id: widget.recipe.slug, commentSourceType: CommentSourceType.recipe, comment: state.comment, replyId: replyId),
],
),
),
@@ -479,29 +409,19 @@ class _AboutRecipeScreenState extends State<AboutRecipeScreen> {
path: 'recipe/${widget.recipe.slug}',
slug: widget.recipe.slug,
),
anchor: Aligned(
shiftToWithinBound: AxisFlag(x: true, y: true),
follower: Alignment.topRight,
target: Alignment.bottomRight,
),
anchor: Aligned(shiftToWithinBound: AxisFlag(x: true, y: true), follower: Alignment.topRight, target: Alignment.bottomRight),
child: IconButton(
onPressed: () {
setState(() {
isMoreOptionsVisible = !isMoreOptionsVisible;
});
},
icon: SvgPicture.asset(
'assets/icons/more_button.svg',
width: 20,
height: 20,
),
icon: SvgPicture.asset('assets/icons/more_button.svg', width: 20, height: 20),
),
),
],
),
body: DataErrorWidget(
onReload: () => context.read<AboutRecipeCubit>().getRecipe(widget.recipe.slug, index: widget.index),
),
body: DataErrorWidget(onReload: () => context.read<AboutRecipeCubit>().getRecipe(widget.recipe.slug, index: widget.index)),
);
}
return Scaffold(
@@ -523,22 +443,14 @@ class _AboutRecipeScreenState extends State<AboutRecipeScreen> {
path: 'recipe/${widget.recipe.slug}',
slug: widget.recipe.slug,
),
anchor: Aligned(
shiftToWithinBound: AxisFlag(x: true, y: true),
follower: Alignment.topRight,
target: Alignment.bottomRight,
),
anchor: Aligned(shiftToWithinBound: AxisFlag(x: true, y: true), follower: Alignment.topRight, target: Alignment.bottomRight),
child: IconButton(
onPressed: () {
setState(() {
isMoreOptionsVisible = !isMoreOptionsVisible;
});
},
icon: SvgPicture.asset(
'assets/icons/more_button.svg',
width: 20,
height: 20,
),
icon: SvgPicture.asset('assets/icons/more_button.svg', width: 20, height: 20),
),
),
],