From 7120260a0b899cb809a4e78d6aa406c5a8687217 Mon Sep 17 00:00:00 2001 From: Alex Date: Wed, 11 Dec 2024 17:01:46 +0300 Subject: [PATCH 1/9] fix: feed cubit --- .../widgets/add_product_modal.dart | 2 +- .../feed/presentation/pages/feed_screen.dart | 75 +++++++++---------- 2 files changed, 37 insertions(+), 40 deletions(-) diff --git a/lib/features/diary/presentation/widgets/add_product_modal.dart b/lib/features/diary/presentation/widgets/add_product_modal.dart index 65852357..563beeb4 100644 --- a/lib/features/diary/presentation/widgets/add_product_modal.dart +++ b/lib/features/diary/presentation/widgets/add_product_modal.dart @@ -154,7 +154,7 @@ class _AddProductModalState extends State { ), ), trailing: Icon( - Icons.keyboard_arrow_right_rounded, + Icons.add_rounded, color: Colors.grey.shade400, ), contentPadding: EdgeInsets.only(left: 12), diff --git a/lib/features/feed/presentation/pages/feed_screen.dart b/lib/features/feed/presentation/pages/feed_screen.dart index 82463215..45fcf1c7 100644 --- a/lib/features/feed/presentation/pages/feed_screen.dart +++ b/lib/features/feed/presentation/pages/feed_screen.dart @@ -171,46 +171,43 @@ class _FeedScreenState extends State { } _buildAllBlogPosts() { - return BlocProvider( - create: (context) => feedCubit, - child: RefreshIndicator( - onRefresh: () => feedCubit.loadFeedBlogPostList(), - child: BlocBuilder( - builder: (BuildContext context, FeedState state) { - if (state is FeedStateLoaded) { - return ListView.separated( - padding: EdgeInsets.symmetric(vertical: 8), - shrinkWrap: true, - physics: BouncingScrollPhysics(), - itemBuilder: (context, index) { - if (index == state.feedBlogPostList.length) { - return const Loader(); - } - return BlogPostWidget(index: index); - }, - separatorBuilder: (context, index) { - return SizedBox(height: 8); - }, - itemCount: state.isLoading ? state.feedBlogPostList.length + 1 : state.feedBlogPostList.length, - ); - } else if (state is FeedStateError) { - return Scaffold( - backgroundColor: Colors.grey.shade200, - body: Padding( - padding: const EdgeInsets.all(16), - child: Center( - child: Text(state.errorMessage), - ), + return RefreshIndicator( + onRefresh: () => feedCubit.loadFeedBlogPostList(), + child: BlocBuilder( + builder: (BuildContext context, FeedState state) { + if (state is FeedStateLoaded) { + return ListView.separated( + padding: EdgeInsets.symmetric(vertical: 8), + shrinkWrap: true, + physics: BouncingScrollPhysics(), + itemBuilder: (context, index) { + if (index == state.feedBlogPostList.length) { + return const Loader(); + } + return BlogPostWidget(index: index); + }, + separatorBuilder: (context, index) { + return SizedBox(height: 8); + }, + itemCount: state.isLoading ? state.feedBlogPostList.length + 1 : state.feedBlogPostList.length, + ); + } else if (state is FeedStateError) { + return Scaffold( + backgroundColor: Colors.grey.shade200, + body: Padding( + padding: const EdgeInsets.all(16), + child: Center( + child: Text(state.errorMessage), ), - ); - } else { - return Scaffold( - backgroundColor: Colors.grey.shade200, - body: const Loader(), - ); - } - }, - ), + ), + ); + } else { + return Scaffold( + backgroundColor: Colors.grey.shade200, + body: const Loader(), + ); + } + }, ), ); } From 2aa4fdc4a8071528a8c0660ec3f36bcd67d6e947 Mon Sep 17 00:00:00 2001 From: Alex Date: Fri, 13 Dec 2024 11:47:20 +0300 Subject: [PATCH 2/9] fix: some fixes --- .../feed/models/feed_blog_post_model.dart | 2 +- .../models/feed_blog_post_model.freezed.dart | 26 +++++++++---------- .../feed/models/feed_blog_post_model.g.dart | 2 +- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/lib/features/feed/models/feed_blog_post_model.dart b/lib/features/feed/models/feed_blog_post_model.dart index f56c2998..d8a21194 100644 --- a/lib/features/feed/models/feed_blog_post_model.dart +++ b/lib/features/feed/models/feed_blog_post_model.dart @@ -18,7 +18,7 @@ class FeedBlogPostModel with _$FeedBlogPostModel { required String title, @JsonKey(name: "total_likes") required int totalLikes, @JsonKey(name: "total_views") required int totalViews, - @JsonKey(name: "total_comments") required int totalComments, + @JsonKey(name: "total_comments") int? totalComments, @JsonKey(name: "was_liked_by_me") required bool wasLikedByMe, }) = _FeedBlogPostModel; diff --git a/lib/features/feed/models/feed_blog_post_model.freezed.dart b/lib/features/feed/models/feed_blog_post_model.freezed.dart index 7814df66..ad757d23 100644 --- a/lib/features/feed/models/feed_blog_post_model.freezed.dart +++ b/lib/features/feed/models/feed_blog_post_model.freezed.dart @@ -37,7 +37,7 @@ mixin _$FeedBlogPostModel { @JsonKey(name: "total_views") int get totalViews => throw _privateConstructorUsedError; @JsonKey(name: "total_comments") - int get totalComments => throw _privateConstructorUsedError; + int? get totalComments => throw _privateConstructorUsedError; @JsonKey(name: "was_liked_by_me") bool get wasLikedByMe => throw _privateConstructorUsedError; @@ -69,7 +69,7 @@ abstract class $FeedBlogPostModelCopyWith<$Res> { String title, @JsonKey(name: "total_likes") int totalLikes, @JsonKey(name: "total_views") int totalViews, - @JsonKey(name: "total_comments") int totalComments, + @JsonKey(name: "total_comments") int? totalComments, @JsonKey(name: "was_liked_by_me") bool wasLikedByMe}); $AuthorCopyWith<$Res> get author; @@ -101,7 +101,7 @@ class _$FeedBlogPostModelCopyWithImpl<$Res, $Val extends FeedBlogPostModel> Object? title = null, Object? totalLikes = null, Object? totalViews = null, - Object? totalComments = null, + Object? totalComments = freezed, Object? wasLikedByMe = null, }) { return _then(_value.copyWith( @@ -149,10 +149,10 @@ class _$FeedBlogPostModelCopyWithImpl<$Res, $Val extends FeedBlogPostModel> ? _value.totalViews : totalViews // ignore: cast_nullable_to_non_nullable as int, - totalComments: null == totalComments + totalComments: freezed == totalComments ? _value.totalComments : totalComments // ignore: cast_nullable_to_non_nullable - as int, + as int?, wasLikedByMe: null == wasLikedByMe ? _value.wasLikedByMe : wasLikedByMe // ignore: cast_nullable_to_non_nullable @@ -191,7 +191,7 @@ abstract class _$$FeedBlogPostModelImplCopyWith<$Res> String title, @JsonKey(name: "total_likes") int totalLikes, @JsonKey(name: "total_views") int totalViews, - @JsonKey(name: "total_comments") int totalComments, + @JsonKey(name: "total_comments") int? totalComments, @JsonKey(name: "was_liked_by_me") bool wasLikedByMe}); @override @@ -222,7 +222,7 @@ class __$$FeedBlogPostModelImplCopyWithImpl<$Res> Object? title = null, Object? totalLikes = null, Object? totalViews = null, - Object? totalComments = null, + Object? totalComments = freezed, Object? wasLikedByMe = null, }) { return _then(_$FeedBlogPostModelImpl( @@ -270,10 +270,10 @@ class __$$FeedBlogPostModelImplCopyWithImpl<$Res> ? _value.totalViews : totalViews // ignore: cast_nullable_to_non_nullable as int, - totalComments: null == totalComments + totalComments: freezed == totalComments ? _value.totalComments : totalComments // ignore: cast_nullable_to_non_nullable - as int, + as int?, wasLikedByMe: null == wasLikedByMe ? _value.wasLikedByMe : wasLikedByMe // ignore: cast_nullable_to_non_nullable @@ -297,7 +297,7 @@ class _$FeedBlogPostModelImpl implements _FeedBlogPostModel { required this.title, @JsonKey(name: "total_likes") required this.totalLikes, @JsonKey(name: "total_views") required this.totalViews, - @JsonKey(name: "total_comments") required this.totalComments, + @JsonKey(name: "total_comments") this.totalComments, @JsonKey(name: "was_liked_by_me") required this.wasLikedByMe}); factory _$FeedBlogPostModelImpl.fromJson(Map json) => @@ -332,7 +332,7 @@ class _$FeedBlogPostModelImpl implements _FeedBlogPostModel { final int totalViews; @override @JsonKey(name: "total_comments") - final int totalComments; + final int? totalComments; @override @JsonKey(name: "was_liked_by_me") final bool wasLikedByMe; @@ -418,7 +418,7 @@ abstract class _FeedBlogPostModel implements FeedBlogPostModel { required final String title, @JsonKey(name: "total_likes") required final int totalLikes, @JsonKey(name: "total_views") required final int totalViews, - @JsonKey(name: "total_comments") required final int totalComments, + @JsonKey(name: "total_comments") final int? totalComments, @JsonKey(name: "was_liked_by_me") required final bool wasLikedByMe}) = _$FeedBlogPostModelImpl; @@ -454,7 +454,7 @@ abstract class _FeedBlogPostModel implements FeedBlogPostModel { int get totalViews; @override @JsonKey(name: "total_comments") - int get totalComments; + int? get totalComments; @override @JsonKey(name: "was_liked_by_me") bool get wasLikedByMe; diff --git a/lib/features/feed/models/feed_blog_post_model.g.dart b/lib/features/feed/models/feed_blog_post_model.g.dart index 50511fed..6abc8a23 100644 --- a/lib/features/feed/models/feed_blog_post_model.g.dart +++ b/lib/features/feed/models/feed_blog_post_model.g.dart @@ -20,7 +20,7 @@ _$FeedBlogPostModelImpl _$$FeedBlogPostModelImplFromJson( title: json['title'] as String, totalLikes: (json['total_likes'] as num).toInt(), totalViews: (json['total_views'] as num).toInt(), - totalComments: (json['total_comments'] as num).toInt(), + totalComments: (json['total_comments'] as num?)?.toInt(), wasLikedByMe: json['was_liked_by_me'] as bool, ); From af1bd525fdcbfb1ab9219e52e2042b9daca0114b Mon Sep 17 00:00:00 2001 From: Alex Date: Fri, 13 Dec 2024 11:59:42 +0300 Subject: [PATCH 3/9] fix: file_picker --- pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index b9f4611f..8c0d6ef2 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -45,7 +45,7 @@ dependencies: flutter_keyboard_visibility: ^6.0.0 share_plus: ^10.1.2 flutter_html: ^3.0.0-beta.2 - file_picker: ^8.1.4 + file_picker: ^8.1.5 audioplayers: ^6.1.0 intl: ^0.19.0 rive: ^0.13.20 From 1c4c73d98eab8ad616f34e15b7abeaa891bd4229 Mon Sep 17 00:00:00 2001 From: Alex Date: Fri, 13 Dec 2024 12:17:21 +0300 Subject: [PATCH 4/9] fix: file_picker ;) --- .../sessions/kotlin-compiler-11108898403823619126.salive | 0 android/app/build.gradle | 6 +++--- pubspec.yaml | 5 ++++- 3 files changed, 7 insertions(+), 4 deletions(-) create mode 100644 android/.kotlin/sessions/kotlin-compiler-11108898403823619126.salive diff --git a/android/.kotlin/sessions/kotlin-compiler-11108898403823619126.salive b/android/.kotlin/sessions/kotlin-compiler-11108898403823619126.salive new file mode 100644 index 00000000..e69de29b diff --git a/android/app/build.gradle b/android/app/build.gradle index 46a74368..ffffdd77 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -10,12 +10,12 @@ android { ndkVersion = "25.1.8937393" compileOptions { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 + sourceCompatibility = JavaVersion.VERSION_21 + targetCompatibility = JavaVersion.VERSION_21 } kotlinOptions { - jvmTarget = JavaVersion.VERSION_1_8 + jvmTarget = 21 } defaultConfig { diff --git a/pubspec.yaml b/pubspec.yaml index 8c0d6ef2..341123b1 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -45,7 +45,10 @@ dependencies: flutter_keyboard_visibility: ^6.0.0 share_plus: ^10.1.2 flutter_html: ^3.0.0-beta.2 - file_picker: ^8.1.5 + file_picker: + git: + url: https://github.com/abdelaziz-mahdy/flutter_file_picker + ref: fix-flutter-3.27-compile-error audioplayers: ^6.1.0 intl: ^0.19.0 rive: ^0.13.20 From 799c63b42722cc8657534b19f4c7c1cdda997f8e Mon Sep 17 00:00:00 2001 From: Alex Date: Fri, 13 Dec 2024 17:11:15 +0300 Subject: [PATCH 5/9] feat: recipe widget --- ...otlin-compiler-11108898403823619126.salive | 0 assets/icons/calories.svg | 6 + assets/icons/clock.svg | 3 + assets/icons/steps.svg | 3 + .../presentation/widgets/recipes_widget.dart | 148 ++++++++++-------- 5 files changed, 93 insertions(+), 67 deletions(-) delete mode 100644 android/.kotlin/sessions/kotlin-compiler-11108898403823619126.salive create mode 100644 assets/icons/calories.svg create mode 100644 assets/icons/clock.svg create mode 100644 assets/icons/steps.svg diff --git a/android/.kotlin/sessions/kotlin-compiler-11108898403823619126.salive b/android/.kotlin/sessions/kotlin-compiler-11108898403823619126.salive deleted file mode 100644 index e69de29b..00000000 diff --git a/assets/icons/calories.svg b/assets/icons/calories.svg new file mode 100644 index 00000000..56188edf --- /dev/null +++ b/assets/icons/calories.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/assets/icons/clock.svg b/assets/icons/clock.svg new file mode 100644 index 00000000..f11f885b --- /dev/null +++ b/assets/icons/clock.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/icons/steps.svg b/assets/icons/steps.svg new file mode 100644 index 00000000..45c8cb6a --- /dev/null +++ b/assets/icons/steps.svg @@ -0,0 +1,3 @@ + + + diff --git a/lib/features/feed/presentation/widgets/recipes_widget.dart b/lib/features/feed/presentation/widgets/recipes_widget.dart index 9e93074b..f8c3d7a1 100644 --- a/lib/features/feed/presentation/widgets/recipes_widget.dart +++ b/lib/features/feed/presentation/widgets/recipes_widget.dart @@ -1,10 +1,13 @@ import 'package:cached_network_image/cached_network_image.dart'; import 'package:eatvio_app/core/const.dart'; +import 'package:eatvio_app/core/widgets/feed_icon_button.dart'; import 'package:eatvio_app/features/feed/models/recipes_model.dart'; import 'package:eatvio_app/core/theme/theme_helper.dart'; import 'package:flutter/material.dart'; import 'package:flutter_html/flutter_html.dart'; +import 'package:flutter_svg/flutter_svg.dart'; import 'package:go_router/go_router.dart'; +import 'package:share_plus/share_plus.dart'; class RecipesWidget extends StatefulWidget { final Recipes recipes; @@ -46,72 +49,14 @@ class _RecipesWidgetState extends State { child: Wrap( runSpacing: 8, children: [ - _iconButton(Icons.fastfood, '139.9 ккал'), + _iconButton('assets/icons/clock.svg', widget.recipes.cookingTime.toString() + ' минут'), SizedBox(width: 8), - _iconButton(Icons.timer_rounded, widget.recipes.cookingTime.toString() + ' минут'), + _iconButton('assets/icons/steps.svg', widget.recipes.steps.length.toString() + ' этапов'), SizedBox(width: 8), - _iconButton(Icons.fast_forward_rounded, widget.recipes.steps.length.toString() + ' этапов'), + _iconButton('assets/icons/calories.svg', '139.9 ккал'), ], ), ), - Positioned( - left: 8, - top: 8, - child: Container( - padding: EdgeInsets.symmetric(horizontal: 8, vertical: 4), - decoration: BoxDecoration( - color: Colors.white.withOpacity(0.8), - borderRadius: BorderRadius.circular(16), - ), - child: Row( - children: [ - Icon( - Icons.favorite_rounded, - size: 16, - color: Colors.black, - ), - SizedBox(width: 4), - Text( - '0', - style: TextStyle( - fontSize: 12, - color: Colors.black, - fontWeight: FontWeight.w400, - ), - ), - ], - ), - ), - ), - Positioned( - right: 8, - top: 8, - child: Container( - padding: EdgeInsets.symmetric(horizontal: 8, vertical: 4), - decoration: BoxDecoration( - color: Colors.white.withOpacity(0.8), - borderRadius: BorderRadius.circular(16), - ), - child: Row( - children: [ - Icon( - Icons.visibility_rounded, - size: 16, - color: Colors.black, - ), - SizedBox(width: 4), - Text( - '0', - style: TextStyle( - fontSize: 12, - color: Colors.black, - fontWeight: FontWeight.w400, - ), - ), - ], - ), - ), - ), ], ), SizedBox(height: 12), @@ -150,27 +95,96 @@ class _RecipesWidgetState extends State { ), ), SizedBox(height: 12), + Padding( + padding: const EdgeInsets.symmetric(horizontal: 12), + child: Row( + children: [ + FeedIconButton( + icon: true ? Icons.favorite_rounded : Icons.favorite_border_rounded, + text: widget.recipes.likesCount.toString(), + iconColor: true ? Colors.red.withOpacity(0.8) : null, + backgroundColor: true ? Colors.red.withOpacity(0.1) : null, + textColor: true ? Colors.red.withOpacity(0.8) : null, + onTap: () async { + // setState(() { + // isLiked = !isLiked; + // isLiked ? totalLikes++ : totalLikes--; + // }); + // isLiked + // ? await context.read().likePost(state.feedBlogPostList[widget.index].id) + // : await context.read().unlikedPost(state.feedBlogPostList[widget.index].id); + // await context.read().loadFeedBlogPostList(); + }, + ), + SizedBox(width: 8), + FeedIconButton( + svgIcon: SvgPicture.asset( + 'assets/icons/comment.svg', + height: 20, + width: 20, + colorFilter: ColorFilter.mode( + appTheme.gray600, + BlendMode.srcIn, + ), + ), + text: widget.recipes.commentsCount.toString(), + onTap: () => GoRouter.of(context).pushNamed( + 'aboutRecipesScreen', + extra: widget.recipes, + ), + ), + SizedBox(width: 8), + FeedIconButton( + svgIcon: SvgPicture.asset( + height: 20, + width: 20, + 'assets/icons/share.svg', + colorFilter: ColorFilter.mode(appTheme.gray600, BlendMode.srcIn), + ), + onTap: () => Share.shareUri( + Uri.parse( + baseUrl + '/ru/blog_post/' + widget.recipes.id.toString(), + ), + ), + ), + Spacer(), + Icon( + Icons.visibility_rounded, + size: 16, + color: appTheme.gray500, + ), + SizedBox(width: 4), + Text( + widget.recipes.viewsCount.toString(), + style: TextStyle( + fontSize: 12, + color: appTheme.gray500, + fontWeight: FontWeight.w400, + ), + ), + ], + ), + ), + SizedBox(height: 12), ], ), ), ); } - _iconButton(IconData icon, [String? text]) { + _iconButton(String iconPath, [String? text]) { return Container( padding: EdgeInsets.symmetric(horizontal: 12, vertical: 4), decoration: BoxDecoration( - color: Colors.white.withOpacity(0.8), + color: Colors.white.withValues(alpha: 0.8), borderRadius: BorderRadius.circular(16), ), height: 32, child: Row( mainAxisSize: MainAxisSize.min, children: [ - Icon( - icon, - size: 16, - color: Colors.black, + SvgPicture.asset( + iconPath, ), if (text != null) SizedBox(width: 8), if (text != null) From 939c5cc6e5f222d81d5da523d642e0f2f0bc3b2d Mon Sep 17 00:00:00 2001 From: Alex Date: Fri, 13 Dec 2024 17:12:16 +0300 Subject: [PATCH 6/9] feat: recipe fix anaylzer --- lib/features/feed/presentation/widgets/recipes_widget.dart | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/features/feed/presentation/widgets/recipes_widget.dart b/lib/features/feed/presentation/widgets/recipes_widget.dart index f8c3d7a1..b1cf23aa 100644 --- a/lib/features/feed/presentation/widgets/recipes_widget.dart +++ b/lib/features/feed/presentation/widgets/recipes_widget.dart @@ -1,3 +1,5 @@ +// ignore_for_file: dead_code + import 'package:cached_network_image/cached_network_image.dart'; import 'package:eatvio_app/core/const.dart'; import 'package:eatvio_app/core/widgets/feed_icon_button.dart'; From 0c09f23e1d3393c800f3a161bc3a0ddce224dd3b Mon Sep 17 00:00:00 2001 From: Alex Date: Fri, 13 Dec 2024 17:13:18 +0300 Subject: [PATCH 7/9] fix: cicd --- .gitea/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/workflows/test.yml b/.gitea/workflows/test.yml index bd6cf419..eac84bf6 100644 --- a/.gitea/workflows/test.yml +++ b/.gitea/workflows/test.yml @@ -3,7 +3,7 @@ name: Eatvio App Android Test on: [ pull_request ] env: - flutter_version: "3.24.5" + flutter_version: "3.27.0" java_version: "21.x" flutter_channel: "stable" my_local_cache_dir: "/opt/hostedtoolcache/" From 7715da6b8ebae4069e47690c26ea9fe64873125e Mon Sep 17 00:00:00 2001 From: Alex Date: Fri, 13 Dec 2024 17:14:09 +0300 Subject: [PATCH 8/9] upd ci cd --- .gitea/workflows/build.yml | 2 +- .gitea/workflows/docker-run-tests.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml index a6d70a2a..acedcf72 100644 --- a/.gitea/workflows/build.yml +++ b/.gitea/workflows/build.yml @@ -3,7 +3,7 @@ name: Eatvio App Android Test on: [ pull_request ] env: - flutter_version: "3.24.5" + flutter_version: "3.27.0" java_version: "21.x" flutter_channel: "stable" diff --git a/.gitea/workflows/docker-run-tests.yml b/.gitea/workflows/docker-run-tests.yml index 99cc866e..52b8e53c 100644 --- a/.gitea/workflows/docker-run-tests.yml +++ b/.gitea/workflows/docker-run-tests.yml @@ -3,7 +3,7 @@ name: Eatvio App Android Test on custom docker on: [ pull_request ] env: - flutter_version: "3.24.5" + flutter_version: "3.27.0" java_version: "21.x" flutter_channel: "stable" my_local_cache_dir: "/opt/hostedtoolcache/" From a58fbf1ee416e1b0a4b67d361d301c686f28e99b Mon Sep 17 00:00:00 2001 From: Alex Date: Fri, 13 Dec 2024 17:41:15 +0300 Subject: [PATCH 9/9] fix: analyzer --- lib/core/theme/app_decoration.dart | 6 +++--- lib/core/theme/theme_helper.dart | 4 ++-- lib/core/widgets/main_background_bouble.dart | 2 +- .../presentation/pages/blog_post_screen.dart | 10 +++++----- .../chat/presentation/pages/chat_screen.dart | 2 +- .../widgets/chat_bubble_widget.dart | 2 +- .../pages/additional_settings_screen.dart | 2 +- .../presentation/diet_preview_screen.dart | 2 +- .../presentation/pages/about_diet_screen.dart | 2 +- .../presentation/widgets/expandable_text.dart | 4 ++-- .../widgets/blog_post_widget.dart | 9 +++++---- .../presentation/widgets/comments_widget.dart | 2 +- .../presentation/widgets/plan_widget.dart | 6 +++--- .../presentation/widgets/recipes_widget.dart | 6 +++--- .../presentation/pages/about_plan_screen.dart | 2 +- .../presentation/pages/profile_screen.dart | 6 +++--- .../widgets/circumference_chart_widget.dart | 10 +++++----- .../widgets/imt_chart_widget.dart | 20 +++++++++---------- .../widgets/profile_blog_post_widget.dart | 12 +++++------ .../widgets/weight_chart_widget.dart | 10 +++++----- .../pages/about_recipes_screen.dart | 2 +- .../presentation/pages/settings_screen.dart | 8 ++++---- 22 files changed, 65 insertions(+), 64 deletions(-) diff --git a/lib/core/theme/app_decoration.dart b/lib/core/theme/app_decoration.dart index eb2c4372..528abdfb 100644 --- a/lib/core/theme/app_decoration.dart +++ b/lib/core/theme/app_decoration.dart @@ -25,7 +25,7 @@ class AppDecoration { ); static BoxDecoration get fillDeepOrange => BoxDecoration( - color: appTheme.deepOrange900.withOpacity(0.8), + color: appTheme.deepOrange900.withValues(alpha: 0.8), ); static BoxDecoration get fillGray => BoxDecoration( @@ -41,7 +41,7 @@ class AppDecoration { ); static BoxDecoration get fillGreenA => BoxDecoration( - color: appTheme.greenA700.withOpacity(0.8), + color: appTheme.greenA700.withValues(alpha: 0.8), ); static BoxDecoration get fillPrimary => BoxDecoration( @@ -77,7 +77,7 @@ class BorderRadiusStyle { color: appTheme.whiteA700, boxShadow: [ BoxShadow( - color: appTheme.black900.withOpacity(0.15), + color: appTheme.black900.withValues(alpha: 0.15), spreadRadius: 2, blurRadius: 2, offset: Offset( diff --git a/lib/core/theme/theme_helper.dart b/lib/core/theme/theme_helper.dart index ab7d7377..615e33df 100644 --- a/lib/core/theme/theme_helper.dart +++ b/lib/core/theme/theme_helper.dart @@ -175,7 +175,7 @@ class PrimaryColors { Color get lightGray => Color(0xFFCECECE); - Color get transparentBlue => Color(0xFF2F80ED).withOpacity(0.1); + Color get transparentBlue => Color(0xFF2F80ED).withValues(alpha: 0.1); Color get lightGray0 => Color(0xFFF6F6F6); @@ -185,7 +185,7 @@ class PrimaryColors { Color get red => Color(0xFFCD4141); - Color get transparentBlack => Color(0xFF1313264).withOpacity(0.3); + Color get transparentBlack => Color(0xFF1313264).withValues(alpha: 0.3); } PrimaryColors get appTheme => ThemeHelper().themeColor(); diff --git a/lib/core/widgets/main_background_bouble.dart b/lib/core/widgets/main_background_bouble.dart index a901ecad..0f1a9fe9 100644 --- a/lib/core/widgets/main_background_bouble.dart +++ b/lib/core/widgets/main_background_bouble.dart @@ -23,7 +23,7 @@ class MainBackgroundBouble extends StatelessWidget { boxShadow: enableShadow ? [ BoxShadow( - color: Color(0x00000000).withOpacity(0.2), + color: Color(0x00000000).withValues(alpha: 0.2), spreadRadius: 0, blurRadius: 32, offset: Offset(0, 0), diff --git a/lib/features/blog_post/presentation/pages/blog_post_screen.dart b/lib/features/blog_post/presentation/pages/blog_post_screen.dart index 3f88ece9..ddb4ddc5 100644 --- a/lib/features/blog_post/presentation/pages/blog_post_screen.dart +++ b/lib/features/blog_post/presentation/pages/blog_post_screen.dart @@ -69,7 +69,7 @@ class _BlogPostScreenState extends State { color: Colors.white, border: Border( top: BorderSide( - color: Colors.black.withOpacity(0.1), + color: Colors.black.withValues(alpha: 0.1), ), ), ), @@ -293,9 +293,9 @@ class _BlogPostScreenState extends State { _iconButton( icon: Icons.favorite_border_rounded, text: totalLikes.toString(), - iconColor: isLiked ? Colors.red.withOpacity(0.8) : null, - backgroundColor: isLiked ? Colors.red.withOpacity(0.1) : null, - textColor: isLiked ? Colors.red.withOpacity(0.8) : null, + iconColor: isLiked ? Colors.red.withValues(alpha: 0.8) : null, + backgroundColor: isLiked ? Colors.red.withValues(alpha: 0.1) : null, + textColor: isLiked ? Colors.red.withValues(alpha: 0.8) : null, onTap: () async { setState(() { isLiked = !isLiked; @@ -338,7 +338,7 @@ class _BlogPostScreenState extends State { width: MediaQuery.of(context).size.width - 32, height: 0.4, decoration: BoxDecoration( - color: Colors.black.withOpacity(0.2), + color: Colors.black.withValues(alpha: 0.2), borderRadius: BorderRadius.circular(16), ), ), diff --git a/lib/features/chat/presentation/pages/chat_screen.dart b/lib/features/chat/presentation/pages/chat_screen.dart index d43411cb..0a6d1b5a 100644 --- a/lib/features/chat/presentation/pages/chat_screen.dart +++ b/lib/features/chat/presentation/pages/chat_screen.dart @@ -184,7 +184,7 @@ class _ChatScreenState extends State { decoration: BoxDecoration( border: Border( top: BorderSide( - color: Colors.black.withOpacity(0.1), + color: Colors.black.withValues(alpha: 0.1), ), ), ), diff --git a/lib/features/chat/presentation/widgets/chat_bubble_widget.dart b/lib/features/chat/presentation/widgets/chat_bubble_widget.dart index 79e3269a..8ef43e8b 100644 --- a/lib/features/chat/presentation/widgets/chat_bubble_widget.dart +++ b/lib/features/chat/presentation/widgets/chat_bubble_widget.dart @@ -116,7 +116,7 @@ class ChatBubbleWidget extends StatelessWidget { child: Text( DateTime.parse(sendTime).format('hh:mm'), style: TextStyle( - color: isCurrentUser ? Colors.white.withOpacity(0.4) : Color(0xFF323F4B).withOpacity(0.4), + color: isCurrentUser ? Colors.white.withValues(alpha: 0.4) : Color(0xFF323F4B).withValues(alpha: 0.4), height: 1, fontSize: 10, ), diff --git a/lib/features/consultant/become_consultant/presentation/pages/additional_settings_screen.dart b/lib/features/consultant/become_consultant/presentation/pages/additional_settings_screen.dart index da799a5e..c7049bff 100644 --- a/lib/features/consultant/become_consultant/presentation/pages/additional_settings_screen.dart +++ b/lib/features/consultant/become_consultant/presentation/pages/additional_settings_screen.dart @@ -94,7 +94,7 @@ class _AdditionalSettingsScreenState extends State { ), trailing: CupertinoSwitch( value: value, - activeColor: appTheme.blueA400, + activeTrackColor: appTheme.blueA400, onChanged: (_) { onTap(); }, diff --git a/lib/features/create_diet/presentation/diet_preview_screen.dart b/lib/features/create_diet/presentation/diet_preview_screen.dart index 4680f763..f06c247e 100644 --- a/lib/features/create_diet/presentation/diet_preview_screen.dart +++ b/lib/features/create_diet/presentation/diet_preview_screen.dart @@ -66,7 +66,7 @@ class _DietPreviewScreenState extends State { color: Colors.white, border: Border( top: BorderSide( - color: Colors.black.withOpacity(0.1), + color: Colors.black.withValues(alpha: 0.1), ), ), ), diff --git a/lib/features/diets/presentation/pages/about_diet_screen.dart b/lib/features/diets/presentation/pages/about_diet_screen.dart index 405e39b0..1ce56fb5 100644 --- a/lib/features/diets/presentation/pages/about_diet_screen.dart +++ b/lib/features/diets/presentation/pages/about_diet_screen.dart @@ -109,7 +109,7 @@ class _AboutDietScreenState extends State { color: Colors.white, border: Border( top: BorderSide( - color: Colors.black.withOpacity(0.1), + color: Colors.black.withValues(alpha: 0.1), ), ), ), diff --git a/lib/features/diets/presentation/widgets/expandable_text.dart b/lib/features/diets/presentation/widgets/expandable_text.dart index c2decf4c..ca4b51ad 100644 --- a/lib/features/diets/presentation/widgets/expandable_text.dart +++ b/lib/features/diets/presentation/widgets/expandable_text.dart @@ -55,8 +55,8 @@ class _ExpandableTextState extends State { begin: Alignment.topCenter, end: Alignment.bottomCenter, colors: [ - Colors.white.withOpacity(0.0), - Colors.white.withOpacity(0.6), + Colors.white.withValues(alpha: 0.0), + Colors.white.withValues(alpha: 0.6), Colors.white, ], ), diff --git a/lib/features/feed/presentation/widgets/blog_post_widget.dart b/lib/features/feed/presentation/widgets/blog_post_widget.dart index be4cdcf7..4cb5c767 100644 --- a/lib/features/feed/presentation/widgets/blog_post_widget.dart +++ b/lib/features/feed/presentation/widgets/blog_post_widget.dart @@ -90,7 +90,8 @@ class _BlogPostWidgetState extends State { ], ), const Spacer(), - if (!(state.feedBlogPostList[widget.index].author.isEntitySubscribedByMe ?? false) && !state.feedBlogPostList[widget.index].author.authorIsMe) + if (!(state.feedBlogPostList[widget.index].author.isEntitySubscribedByMe ?? false) && + !state.feedBlogPostList[widget.index].author.authorIsMe) SubscribeButtonWidget( slug: state.feedBlogPostList[widget.index].author.authorSlug, ), @@ -167,9 +168,9 @@ class _BlogPostWidgetState extends State { FeedIconButton( icon: isLiked ? Icons.favorite_rounded : Icons.favorite_border_rounded, text: totalLikes.toString(), - iconColor: isLiked ? Colors.red.withOpacity(0.8) : null, - backgroundColor: isLiked ? Colors.red.withOpacity(0.1) : null, - textColor: isLiked ? Colors.red.withOpacity(0.8) : null, + iconColor: isLiked ? Colors.red.withValues(alpha: 0.8) : null, + backgroundColor: isLiked ? Colors.red.withValues(alpha: 0.1) : null, + textColor: isLiked ? Colors.red.withValues(alpha: 0.8) : null, onTap: () async { setState(() { isLiked = !isLiked; diff --git a/lib/features/feed/presentation/widgets/comments_widget.dart b/lib/features/feed/presentation/widgets/comments_widget.dart index caf9c4ad..ac4ea977 100644 --- a/lib/features/feed/presentation/widgets/comments_widget.dart +++ b/lib/features/feed/presentation/widgets/comments_widget.dart @@ -50,7 +50,7 @@ class _CommentsWidgetState extends State { return Container( width: MediaQuery.of(context).size.width, decoration: BoxDecoration( - color: widget.replyId == comment.id ? appTheme.blueA400.withOpacity(0.1) : Colors.white, + color: widget.replyId == comment.id ? appTheme.blueA400.withValues(alpha: 0.1) : Colors.white, borderRadius: BorderRadius.circular(16), ), child: Padding( diff --git a/lib/features/feed/presentation/widgets/plan_widget.dart b/lib/features/feed/presentation/widgets/plan_widget.dart index 5d844029..4b06166a 100644 --- a/lib/features/feed/presentation/widgets/plan_widget.dart +++ b/lib/features/feed/presentation/widgets/plan_widget.dart @@ -60,7 +60,7 @@ class PlanWidget extends StatelessWidget { child: Container( padding: EdgeInsets.symmetric(horizontal: 8, vertical: 4), decoration: BoxDecoration( - color: Colors.white.withOpacity(0.8), + color: Colors.white.withValues(alpha: 0.8), borderRadius: BorderRadius.circular(16), ), child: Row( @@ -89,7 +89,7 @@ class PlanWidget extends StatelessWidget { child: Container( padding: EdgeInsets.symmetric(horizontal: 8, vertical: 4), decoration: BoxDecoration( - color: Colors.white.withOpacity(0.8), + color: Colors.white.withValues(alpha: 0.8), borderRadius: BorderRadius.circular(16), ), child: Row( @@ -147,7 +147,7 @@ class PlanWidget extends StatelessWidget { return Container( padding: EdgeInsets.symmetric(horizontal: 12, vertical: 4), decoration: BoxDecoration( - color: Colors.white.withOpacity(0.8), + color: Colors.white.withValues(alpha: 0.8), borderRadius: BorderRadius.circular(16), ), height: 32, diff --git a/lib/features/feed/presentation/widgets/recipes_widget.dart b/lib/features/feed/presentation/widgets/recipes_widget.dart index b1cf23aa..eb4b065f 100644 --- a/lib/features/feed/presentation/widgets/recipes_widget.dart +++ b/lib/features/feed/presentation/widgets/recipes_widget.dart @@ -104,9 +104,9 @@ class _RecipesWidgetState extends State { FeedIconButton( icon: true ? Icons.favorite_rounded : Icons.favorite_border_rounded, text: widget.recipes.likesCount.toString(), - iconColor: true ? Colors.red.withOpacity(0.8) : null, - backgroundColor: true ? Colors.red.withOpacity(0.1) : null, - textColor: true ? Colors.red.withOpacity(0.8) : null, + iconColor: true ? Colors.red.withValues(alpha: 0.8) : null, + backgroundColor: true ? Colors.red.withValues(alpha: 0.1) : null, + textColor: true ? Colors.red.withValues(alpha: 0.8) : null, onTap: () async { // setState(() { // isLiked = !isLiked; diff --git a/lib/features/plans/presentation/pages/about_plan_screen.dart b/lib/features/plans/presentation/pages/about_plan_screen.dart index 1f2aa1cf..d49db1b0 100644 --- a/lib/features/plans/presentation/pages/about_plan_screen.dart +++ b/lib/features/plans/presentation/pages/about_plan_screen.dart @@ -107,7 +107,7 @@ class _AboutPlanScreenState extends State { color: Colors.white, border: Border( top: BorderSide( - color: Colors.black.withOpacity(0.1), + color: Colors.black.withValues(alpha: 0.1), ), ), ), diff --git a/lib/features/profile/presentation/pages/profile_screen.dart b/lib/features/profile/presentation/pages/profile_screen.dart index 9c0f18ad..e227e113 100644 --- a/lib/features/profile/presentation/pages/profile_screen.dart +++ b/lib/features/profile/presentation/pages/profile_screen.dart @@ -811,7 +811,7 @@ class _ProfileScreenState extends State { child: Text( text, style: TextStyle( - color: Colors.black.withOpacity(0.4), + color: Colors.black.withValues(alpha: 0.4), height: 1, ), ), @@ -1044,7 +1044,7 @@ class _ProfileScreenState extends State { padding: EdgeInsets.all(8), width: (MediaQuery.of(context).size.width - 40) / 2, decoration: BoxDecoration( - color: appTheme.blueA400.withOpacity(0.1), + color: appTheme.blueA400.withValues(alpha: 0.1), borderRadius: BorderRadius.circular(16), ), child: Text( @@ -1150,7 +1150,7 @@ class _ProfileScreenState extends State { _choiceIntervalChipWidget(int index) { return ChoiceChip( - selectedColor: Colors.grey.withOpacity(0.1), + selectedColor: Colors.grey.withValues(alpha: 0.1), pressElevation: 0, showCheckmark: false, side: BorderSide.none, diff --git a/lib/features/profile/presentation/widgets/circumference_chart_widget.dart b/lib/features/profile/presentation/widgets/circumference_chart_widget.dart index f116ccf5..82130c54 100644 --- a/lib/features/profile/presentation/widgets/circumference_chart_widget.dart +++ b/lib/features/profile/presentation/widgets/circumference_chart_widget.dart @@ -154,9 +154,9 @@ class _CircumferenceChartWidgetState extends State { labelStyle: TextStyle( color: Colors.grey, ), - majorGridLines: MajorGridLines(dashArray: [1], color: Colors.grey.withOpacity(0.3)), + majorGridLines: MajorGridLines(dashArray: [1], color: Colors.grey.withValues(alpha: 0.3)), axisLine: AxisLine( - color: Colors.grey.withOpacity(0.3), + color: Colors.grey.withValues(alpha: 0.3), width: 0.4, ), ), @@ -309,7 +309,7 @@ class _CircumferenceChartWidgetState extends State { borderColor: seriesColor1, gradient: LinearGradient( colors: [ - seriesColor1.withOpacity(0.14), + seriesColor1.withValues(alpha: 0.14), Colors.transparent, ], begin: Alignment.topCenter, @@ -334,7 +334,7 @@ class _CircumferenceChartWidgetState extends State { borderColor: seriesColor2, gradient: LinearGradient( colors: [ - seriesColor2.withOpacity(0.14), + seriesColor2.withValues(alpha: 0.14), Colors.transparent, ], begin: Alignment.topCenter, @@ -359,7 +359,7 @@ class _CircumferenceChartWidgetState extends State { borderColor: seriesColor3, gradient: LinearGradient( colors: [ - seriesColor3.withOpacity(0.14), + seriesColor3.withValues(alpha: 0.14), Colors.transparent, ], begin: Alignment.topCenter, diff --git a/lib/features/profile/presentation/widgets/imt_chart_widget.dart b/lib/features/profile/presentation/widgets/imt_chart_widget.dart index d7264772..14dc3dee 100644 --- a/lib/features/profile/presentation/widgets/imt_chart_widget.dart +++ b/lib/features/profile/presentation/widgets/imt_chart_widget.dart @@ -22,14 +22,14 @@ class ImtChartWidget extends StatelessWidget { child: Row( children: [ if (weightPoints.length > 0) - Text( - '${weightPoints.last.bmi.toStringAsFixed(2)}', - style: TextStyle( - color: Colors.black, - fontSize: 40, - fontWeight: FontWeight.w500, + Text( + '${weightPoints.last.bmi.toStringAsFixed(2)}', + style: TextStyle( + color: Colors.black, + fontSize: 40, + fontWeight: FontWeight.w500, + ), ), - ), if (weightPoints.length > 1) weightPoints.last.bmi > weightPoints[weightPoints.length - 2].bmi ? Icon( @@ -66,9 +66,9 @@ class ImtChartWidget extends StatelessWidget { labelStyle: TextStyle( color: Colors.grey, ), - majorGridLines: MajorGridLines(dashArray: [1], color: Colors.grey.withOpacity(0.3)), + majorGridLines: MajorGridLines(dashArray: [1], color: Colors.grey.withValues(alpha: 0.3)), axisLine: AxisLine( - color: Colors.grey.withOpacity(0.3), + color: Colors.grey.withValues(alpha: 0.3), width: 0.4, ), ), @@ -99,7 +99,7 @@ class ImtChartWidget extends StatelessWidget { borderColor: appTheme.blueA400, gradient: LinearGradient( colors: [ - appTheme.blueA400.withOpacity(0.14), + appTheme.blueA400.withValues(alpha: 0.14), Colors.transparent, ], begin: Alignment.topCenter, diff --git a/lib/features/profile/presentation/widgets/profile_blog_post_widget.dart b/lib/features/profile/presentation/widgets/profile_blog_post_widget.dart index 6fcb4f40..a448ed10 100644 --- a/lib/features/profile/presentation/widgets/profile_blog_post_widget.dart +++ b/lib/features/profile/presentation/widgets/profile_blog_post_widget.dart @@ -166,9 +166,9 @@ class _ProfileBlogPostWidgetState extends State { FeedIconButton( icon: isLiked ? Icons.favorite_rounded : Icons.favorite_border_rounded, text: totalLikes.toString(), - iconColor: isLiked ? Colors.red.withOpacity(0.8) : null, - backgroundColor: isLiked ? Colors.red.withOpacity(0.1) : null, - textColor: isLiked ? Colors.red.withOpacity(0.8) : null, + iconColor: isLiked ? Colors.red.withValues(alpha: 0.8) : null, + backgroundColor: isLiked ? Colors.red.withValues(alpha: 0.1) : null, + textColor: isLiked ? Colors.red.withValues(alpha: 0.8) : null, onTap: () async { setState(() { isLiked = !isLiked; @@ -178,9 +178,9 @@ class _ProfileBlogPostWidgetState extends State { ? await context.read().likePost(state.blogPosts[widget.index].id) : await context.read().unlikedPost(state.blogPosts[widget.index].id); await widget.profileCubit.updateFeedBlogPostList( - state.blogPosts[widget.index], - isLiked ? false : true, - ); + state.blogPosts[widget.index], + isLiked ? false : true, + ); }, ), SizedBox(width: 8), diff --git a/lib/features/profile/presentation/widgets/weight_chart_widget.dart b/lib/features/profile/presentation/widgets/weight_chart_widget.dart index 3cdfd930..082befe0 100644 --- a/lib/features/profile/presentation/widgets/weight_chart_widget.dart +++ b/lib/features/profile/presentation/widgets/weight_chart_widget.dart @@ -59,12 +59,12 @@ class _WeightChartWidgetState extends State { ? Icon( Icons.arrow_drop_up, size: 40, - color: Colors.grey.withOpacity(0.4), + color: Colors.grey.withValues(alpha: 0.4), ) : Icon( Icons.arrow_drop_down, size: 40, - color: Colors.grey.withOpacity(0.4), + color: Colors.grey.withValues(alpha: 0.4), ), ], ), @@ -93,9 +93,9 @@ class _WeightChartWidgetState extends State { labelStyle: TextStyle( color: Colors.grey, ), - majorGridLines: MajorGridLines(dashArray: [1], color: Colors.grey.withOpacity(0.3)), + majorGridLines: MajorGridLines(dashArray: [1], color: Colors.grey.withValues(alpha: 0.3)), axisLine: AxisLine( - color: Colors.grey.withOpacity(0.3), + color: Colors.grey.withValues(alpha: 0.3), width: 0.4, ), ), @@ -227,7 +227,7 @@ class _WeightChartWidgetState extends State { borderColor: appTheme.blueA400, gradient: LinearGradient( colors: [ - appTheme.blueA400.withOpacity(0.14), + appTheme.blueA400.withValues(alpha: 0.14), Colors.transparent, ], begin: Alignment.topCenter, diff --git a/lib/features/recipes/presentation/pages/about_recipes_screen.dart b/lib/features/recipes/presentation/pages/about_recipes_screen.dart index 20162eca..e5749b7d 100644 --- a/lib/features/recipes/presentation/pages/about_recipes_screen.dart +++ b/lib/features/recipes/presentation/pages/about_recipes_screen.dart @@ -55,7 +55,7 @@ class _AboutRecipesScreenState extends State { color: Colors.white, border: Border( top: BorderSide( - color: Colors.black.withOpacity(0.1), + color: Colors.black.withValues(alpha: 0.1), ), ), ), diff --git a/lib/features/settings/presentation/pages/settings_screen.dart b/lib/features/settings/presentation/pages/settings_screen.dart index cccb16b7..af2e9387 100644 --- a/lib/features/settings/presentation/pages/settings_screen.dart +++ b/lib/features/settings/presentation/pages/settings_screen.dart @@ -216,7 +216,7 @@ class _SettingsScreenState extends State { title: 'Уведомление о новых обновлениях', trailing: CupertinoSwitch( value: updatesNotificationsSwitchState, - activeColor: appTheme.blueA400, + activeTrackColor: appTheme.blueA400, onChanged: (newValue) { setState(() { updatesNotificationsSwitchState = newValue; @@ -245,7 +245,7 @@ class _SettingsScreenState extends State { title: 'Напоминание о заполнении дневника', trailing: CupertinoSwitch( value: fillDiaryNotificationsSwitchState, - activeColor: appTheme.blueA400, + activeTrackColor: appTheme.blueA400, onChanged: (newValue) { setState(() { fillDiaryNotificationsSwitchState = newValue; @@ -274,7 +274,7 @@ class _SettingsScreenState extends State { title: 'Указывать “настроение” в заполнение дневника', trailing: CupertinoSwitch( value: moodSwitchState, - activeColor: appTheme.blueA400, + activeTrackColor: appTheme.blueA400, onChanged: (newValue) { setState(() { moodSwitchState = newValue; @@ -303,7 +303,7 @@ class _SettingsScreenState extends State { title: 'Указывать “отход ко сну” в заполнение дневника', trailing: CupertinoSwitch( value: bedTimeSwitchState, - activeColor: appTheme.blueA400, + activeTrackColor: appTheme.blueA400, onChanged: (newValue) { setState(() { bedTimeSwitchState = newValue;