feat(feed): about diets screen

This commit is contained in:
mso7nueh
2024-08-09 15:10:27 +03:00
parent 6620ed5337
commit 4af39985ee
5 changed files with 122 additions and 4 deletions

View File

@@ -8,6 +8,8 @@ import 'package:eatvio_app/features/chat/presentation/pages/chat_screen.dart';
import 'package:eatvio_app/features/chat/presentation/pages/chat_select_screen/chat_select_screen.dart';
import 'package:eatvio_app/features/chat/presentation/pages/photo_view_screen.dart';
import 'package:eatvio_app/features/diary/presentation/pages/diary_screen.dart';
import 'package:eatvio_app/features/diets/presentation/pages/about_diet_screen.dart';
import 'package:eatvio_app/features/feed/models/diets_pagination_model.dart';
import 'package:eatvio_app/features/feed/models/recipes_model.dart';
import 'package:eatvio_app/features/feed/presentation/pages/feed_screen.dart';
import 'package:eatvio_app/features/recipes/presentation/pages/about_recipes_screen.dart';
@@ -92,6 +94,13 @@ class AppRouter {
recipes: state.extra as Recipes,
),
),
GoRoute(
path: '/about-diet-screen',
name: 'aboutDietScreen',
builder: (context, state) => AboutDietScreen(
datum: state.extra as Datum,
),
),
GoRoute(
path: '/blog-post-create-screen',
name: 'blogPostCreateScreen',

View File

@@ -0,0 +1,94 @@
import 'package:cached_network_image/cached_network_image.dart';
import 'package:eatvio_app/core/constants/constants.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';
class AboutDietScreen extends StatelessWidget {
final Datum datum;
const AboutDietScreen({super.key, required this.datum});
@override
Widget build(BuildContext context) {
return Scaffold(
floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat,
floatingActionButton: SizedBox(
width: MediaQuery.of(context).size.width - 32,
child: FloatingActionButton.extended(
heroTag: 'nextButtonRegistration',
highlightElevation: 0,
elevation: 0,
focusElevation: 0,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(16),
),
backgroundColor: appTheme.greenA700,
onPressed: () {},
label: Text(
'Начать диету',
style: theme.textTheme.titleSmall,
),
),
),
appBar: AppBar(),
body: SingleChildScrollView(
padding: EdgeInsets.only(bottom: 80),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: Text(
datum.name,
style: TextStyle(
color: Colors.black,
fontSize: 24,
fontWeight: FontWeight.w500,
height: 1,
),
),
),
SizedBox(height: 12),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: Row(
children: [
Icon(Icons.timer_outlined),
SizedBox(width: 4),
Text(
datum.duration.toString() + ' дней',
style: TextStyle(
color: Colors.black,
fontSize: 12,
fontWeight: FontWeight.w400,
height: 1,
),
),
],
),
),
SizedBox(height: 12),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: Text(
datum.details,
style: TextStyle(
color: Colors.black,
fontSize: 14,
fontWeight: FontWeight.w400,
height: 1.2,
),
),
),
SizedBox(height: 12),
CachedNetworkImage(
imageUrl: baseUrl + '/storage/' + datum.image,
),
SizedBox(height: 12),
],
),
),
);
}
}

View File

@@ -64,8 +64,10 @@ class _FeedScreenState extends State<FeedScreen> {
return _buildAllBlogPosts();
else if (_selectedChipIndex == 1)
return _buildAllRecipes();
else
else if (_selectedChipIndex == 2)
return _buildDiets();
else
return Center(child: Text(chipsLabelList[_selectedChipIndex]));
},
),
),

View File

@@ -84,7 +84,7 @@ class _DietsWidgetState extends State<DietsWidget> {
),
SizedBox(width: 4),
Text(
'0',
widget.datum.totalLikes.toString(),
style: TextStyle(
fontSize: 12,
color: Colors.black,
@@ -113,7 +113,7 @@ class _DietsWidgetState extends State<DietsWidget> {
),
SizedBox(width: 4),
Text(
'0',
widget.datum.totalViews.toString(),
style: TextStyle(
fontSize: 12,
color: Colors.black,

View File

@@ -61,6 +61,19 @@ class AboutRecipesScreen extends StatelessWidget {
),
),
SizedBox(height: 12),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: Text(
recipes.description,
style: TextStyle(
color: Colors.black,
fontSize: 14,
fontWeight: FontWeight.w400,
height: 1.2,
),
),
),
SizedBox(height: 12),
CachedNetworkImage(
imageUrl: baseUrl + '/storage/' + recipes.image,
),
@@ -124,7 +137,7 @@ class AboutRecipesScreen extends StatelessWidget {
_ingredient(Ingredient ingredient) {
return Text(
'• '+ ingredient.name + ' ' + ingredient.portion + ' ' + (ingredient.unit ?? ''),
'• ' + ingredient.name + ' ' + ingredient.portion + ' ' + (ingredient.unit ?? ''),
style: TextStyle(
color: Colors.black,
fontSize: 14,