From 3ba48289b0b7b3f688f5546957c55a56d5eecee2 Mon Sep 17 00:00:00 2001 From: mso7nueh Date: Fri, 2 Aug 2024 17:52:06 +0300 Subject: [PATCH] feat(recipes): add recipes screen --- .../feed/presentation/pages/feed_screen.dart | 4 - .../widgets/blog_post_widget.dart | 9 +- .../pages/about_recipes_screen.dart | 98 ++++++++++++++++--- 3 files changed, 88 insertions(+), 23 deletions(-) diff --git a/lib/features/feed/presentation/pages/feed_screen.dart b/lib/features/feed/presentation/pages/feed_screen.dart index cb6c714d..5cfa1005 100644 --- a/lib/features/feed/presentation/pages/feed_screen.dart +++ b/lib/features/feed/presentation/pages/feed_screen.dart @@ -7,7 +7,6 @@ import 'package:eatvio_app/features/feed/presentation/widgets/recipes_widget.dar import 'package:eatvio_app/theme/theme_helper.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:go_router/go_router.dart'; @@ -29,9 +28,6 @@ class _FeedScreenState extends State { appBar: AppBar( backgroundColor: Colors.white, toolbarHeight: 0, - systemOverlayStyle: SystemUiOverlayStyle( - statusBarColor: Colors.white, - ), ), backgroundColor: Colors.grey.shade200, body: NestedScrollView( diff --git a/lib/features/feed/presentation/widgets/blog_post_widget.dart b/lib/features/feed/presentation/widgets/blog_post_widget.dart index ee629c33..1139fe0f 100644 --- a/lib/features/feed/presentation/widgets/blog_post_widget.dart +++ b/lib/features/feed/presentation/widgets/blog_post_widget.dart @@ -20,11 +20,10 @@ class _BlogPostWidgetState extends State { Widget build(BuildContext context) { return InkWell( borderRadius: BorderRadius.circular(12), - onTap: () => - GoRouter.of(context).pushNamed( - 'blogPostScreen', - extra: widget.feedBlogPostModel.id.toString(), - ), + onTap: () => GoRouter.of(context).pushNamed( + 'blogPostScreen', + extra: widget.feedBlogPostModel.id.toString(), + ), child: Ink( decoration: BoxDecoration( borderRadius: BorderRadius.circular(12), diff --git a/lib/features/recipes/presentation/pages/about_recipes_screen.dart b/lib/features/recipes/presentation/pages/about_recipes_screen.dart index aa83ef21..27d69e38 100644 --- a/lib/features/recipes/presentation/pages/about_recipes_screen.dart +++ b/lib/features/recipes/presentation/pages/about_recipes_screen.dart @@ -14,35 +14,105 @@ class AboutRecipesScreen extends StatelessWidget { return Scaffold( appBar: AppBar(), body: SingleChildScrollView( - padding: EdgeInsets.all(16), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text(recipes.title), - Row( - children: [ - Text(recipes.cookingTime.toString() + ' минут'), - SizedBox(width: 16), - Text(recipes.steps.length.toString() + ' этапов'), - ], + Padding( + padding: const EdgeInsets.symmetric(horizontal: 16), + child: Text( + recipes.title, + style: TextStyle( + color: Colors.black, + fontSize: 24, + fontWeight: FontWeight.w500, + height: 1, + ), + ), ), - Text(recipes.videoUrl), - CachedNetworkImage(imageUrl: baseUrl + '/storage/' + recipes.image), + SizedBox(height: 12), + Padding( + padding: const EdgeInsets.symmetric(horizontal: 16), + child: Row( + children: [ + Icon(Icons.timer_outlined), + SizedBox(width: 4), + Text( + recipes.cookingTime.toString() + ' минут', + style: TextStyle( + color: Colors.black, + fontSize: 12, + fontWeight: FontWeight.w400, + height: 1, + ), + ), + SizedBox(width: 16), + Icon(Icons.fast_forward_outlined), + SizedBox(width: 4), + Text( + recipes.steps.length.toString() + ' этапов', + style: TextStyle( + color: Colors.black, + fontSize: 12, + fontWeight: FontWeight.w400, + height: 1, + ), + ), + ], + ), + ), + SizedBox(height: 12), + CachedNetworkImage( + imageUrl: baseUrl + '/storage/' + recipes.image, + ), + SizedBox(height: 12), Text(recipes.ingredients.toString()), Text('Пошаговый рецепт'), - for (int i = 0; i < recipes.steps.length; i++) ...[_step(recipes.steps[i])], + ListView.separated( + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + itemBuilder: (context, index) => + _step(recipes.steps[index], index + 1), + separatorBuilder: (context, index) => SizedBox(height: 16), + itemCount: recipes.steps.length, + ), ], ), ), ); } - _step(step.Step step) { + _step(step.Step step, int stepNubmer) { return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text(step.description), - if (step.image.length > 1) CachedNetworkImage(imageUrl: baseUrl + '/storage/' + step.image), + Padding( + padding: const EdgeInsets.symmetric(horizontal: 16), + child: Text( + 'Шаг ' + stepNubmer.toString(), + style: TextStyle( + color: Colors.black54, + fontSize: 14, + fontWeight: FontWeight.w400, + height: 1, + ), + ), + ), + SizedBox(height: 12), + Padding( + padding: const EdgeInsets.symmetric(horizontal: 16), + child: Text( + step.description, + style: TextStyle( + color: Colors.black, + fontSize: 14, + fontWeight: FontWeight.w400, + height: 1.2, + ), + ), + ), + SizedBox(height: 8), + if (step.image.length > 1) + CachedNetworkImage(imageUrl: baseUrl + '/storage/' + step.image), ], ); }