forked from eatvio/eatvio_app
feat(profile): add profile charts models, requests. Max length of description in posts, recipes, diets = 200
This commit is contained in:
@@ -105,7 +105,9 @@ class _BlogPostWidgetState extends State<BlogPostWidget> {
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 4),
|
||||
child: Html(
|
||||
data: widget.feedBlogPostModel.description,
|
||||
data: widget.feedBlogPostModel.description.length > 200
|
||||
? widget.feedBlogPostModel.description.substring(0, 200)
|
||||
: widget.feedBlogPostModel.description,
|
||||
style: {
|
||||
"*": Style(
|
||||
color: Colors.black87,
|
||||
@@ -113,6 +115,18 @@ class _BlogPostWidgetState extends State<BlogPostWidget> {
|
||||
},
|
||||
),
|
||||
),
|
||||
if (widget.feedBlogPostModel.description.length > 200)
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
child: Text(
|
||||
'Читать полностью...',
|
||||
style: TextStyle(
|
||||
height: 1,
|
||||
color: appTheme.blueA400,
|
||||
decoration: TextDecoration.underline,
|
||||
),
|
||||
),
|
||||
),
|
||||
if (widget.feedBlogPostModel.title.isNotEmpty || widget.feedBlogPostModel.description.isNotEmpty) SizedBox(height: 8),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:eatvio_app/core/const.dart';
|
||||
import 'package:eatvio_app/features/feed/models/diets_pagination_model.dart';
|
||||
import 'package:eatvio_app/theme/theme_helper.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_html/flutter_html.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
@@ -124,17 +125,30 @@ class _DietsWidgetState extends State<DietsWidget> {
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 4),
|
||||
child: Html(
|
||||
data: widget.diet.details,
|
||||
style: {
|
||||
"*": Style(
|
||||
color: Colors.black87,
|
||||
),
|
||||
},
|
||||
if (widget.diet.details.isNotEmpty)
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 4),
|
||||
child: Html(
|
||||
data: widget.diet.details.length > 200 ? widget.diet.details.substring(0, 200) : widget.diet.details,
|
||||
style: {
|
||||
"*": Style(
|
||||
color: Colors.black87,
|
||||
),
|
||||
},
|
||||
),
|
||||
),
|
||||
if (widget.diet.details.length > 200)
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
child: Text(
|
||||
'Читать полностью...',
|
||||
style: TextStyle(
|
||||
height: 1,
|
||||
color: appTheme.blueA400,
|
||||
decoration: TextDecoration.underline,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 12),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:eatvio_app/core/const.dart';
|
||||
import 'package:eatvio_app/features/feed/models/recipes_model.dart';
|
||||
import 'package:eatvio_app/theme/theme_helper.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_html/flutter_html.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
@@ -124,17 +125,30 @@ class _RecipesWidgetState extends State<RecipesWidget> {
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 4),
|
||||
child: Html(
|
||||
data: widget.recipes.description,
|
||||
style: {
|
||||
"*": Style(
|
||||
color: Colors.black87,
|
||||
),
|
||||
},
|
||||
if (widget.recipes.description.isNotEmpty)
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 4),
|
||||
child: Html(
|
||||
data: widget.recipes.description.length > 200 ? widget.recipes.description.substring(0, 200) : widget.recipes.description,
|
||||
style: {
|
||||
"*": Style(
|
||||
color: Colors.black87,
|
||||
),
|
||||
},
|
||||
),
|
||||
),
|
||||
if (widget.recipes.description.length > 200)
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
child: Text(
|
||||
'Читать полностью...',
|
||||
style: TextStyle(
|
||||
height: 1,
|
||||
color: appTheme.blueA400,
|
||||
decoration: TextDecoration.underline,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 12),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -1,17 +1,16 @@
|
||||
import 'package:eatvio_app/features/feed/presentation/bloc/recipes_cubit/recipes_cubit.dart';
|
||||
import 'package:eatvio_app/features/feed/presentation/bloc/recipes_cubit/recipes_state.dart';
|
||||
import 'package:eatvio_app/features/recipes/models/recipe_tag_model.dart';
|
||||
import 'package:eatvio_app/theme/theme_helper.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
|
||||
class TagsModalWidget extends StatefulWidget {
|
||||
final List<RecipeTag> tagsList;
|
||||
final Set<int> selectedTags;
|
||||
final RecipesCubit recipesCubit;
|
||||
|
||||
const TagsModalWidget({
|
||||
super.key,
|
||||
required this.tagsList,
|
||||
required this.selectedTags,
|
||||
required this.recipesCubit,
|
||||
});
|
||||
|
||||
@override
|
||||
@@ -21,20 +20,29 @@ class TagsModalWidget extends StatefulWidget {
|
||||
class _TagsModalWidgetState extends State<TagsModalWidget> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
padding: EdgeInsets.all(16),
|
||||
width: MediaQuery.of(context).size.width,
|
||||
child: Wrap(
|
||||
spacing: 8,
|
||||
runSpacing: -8,
|
||||
children: [
|
||||
for (int i = 0; i < widget.tagsList.length; i++)
|
||||
_tagChip(
|
||||
tag: widget.tagsList[i],
|
||||
isSelected: widget.selectedTags.contains(widget.tagsList[i].id),
|
||||
return BlocBuilder<RecipesCubit, RecipesState>(
|
||||
bloc: widget.recipesCubit,
|
||||
builder: (BuildContext context, RecipesState state) {
|
||||
if (state is RecipesStateLoaded) {
|
||||
return Container(
|
||||
padding: EdgeInsets.all(16),
|
||||
width: MediaQuery.of(context).size.width,
|
||||
child: Wrap(
|
||||
spacing: 8,
|
||||
runSpacing: -8,
|
||||
children: [
|
||||
for (int i = 0; i < state.recipesTags.length; i++)
|
||||
_tagChip(
|
||||
tag: state.recipesTags[i],
|
||||
isSelected: state.selectedTags.contains(state.recipesTags[i].id),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
} else {
|
||||
return Container();
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -58,7 +66,7 @@ class _TagsModalWidgetState extends State<TagsModalWidget> {
|
||||
),
|
||||
selected: isSelected,
|
||||
backgroundColor: appTheme.gray100,
|
||||
onSelected: (bool selected) => context.read<RecipesCubit>().updateTags(tag),
|
||||
onSelected: (bool selected) => widget.recipesCubit.updateTags(tag),
|
||||
label: Text(
|
||||
'${tag.name} ${tag.recipesCount}',
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user