diff --git a/android/app/build.gradle b/android/app/build.gradle
index 4df5da7f..a5377cc6 100644
--- a/android/app/build.gradle
+++ b/android/app/build.gradle
@@ -16,7 +16,7 @@ if (keystorePropertiesFile.exists()) {
android {
namespace = "com.eatvioapp.app"
compileSdk = flutter.compileSdkVersion
- ndkVersion = "27.0.12077973"
+ ndkVersion = "27.0.12077973"
compileOptions {
sourceCompatibility = JavaVersion.VERSION_21
diff --git a/assets/icons/blocked_users.svg b/assets/icons/blocked_users.svg
new file mode 100644
index 00000000..819b2245
--- /dev/null
+++ b/assets/icons/blocked_users.svg
@@ -0,0 +1,29 @@
+
+
+
+
diff --git a/lib/core/app_router.dart b/lib/core/app_router.dart
index 2affcfd1..2f4c88fa 100644
--- a/lib/core/app_router.dart
+++ b/lib/core/app_router.dart
@@ -25,6 +25,7 @@ import 'package:eatvio_app/features/consultant/become_consultant/presentation/pa
import 'package:eatvio_app/features/consultations/presentation/pages/consultations_screen.dart';
import 'package:eatvio_app/features/finances_and_consultations_archive/presentation/consultant_finances_screen.dart';
import 'package:eatvio_app/features/finances_and_consultations_archive/presentation/user_purchases_screen.dart';
+import 'package:eatvio_app/features/menu/presentation/pages/blocked_users_screen.dart';
import 'package:eatvio_app/features/order_info/presentation/info_by_order_screen.dart';
import 'package:eatvio_app/features/create_diet/presentation/create_diet_screen.dart';
import 'package:eatvio_app/features/create_diet/presentation/diet_preview_screen.dart';
@@ -169,6 +170,11 @@ class AppRouter {
),
],
),
+ GoRoute(
+ name: 'blockedUsersScreen',
+ path: '/blocked-users-screen',
+ builder: (context, state) => const BlockedUsersScreen(),
+ ),
GoRoute(
path: '/welcome-screen',
name: 'welcomeScreen',
diff --git a/lib/core/locator_service.dart b/lib/core/locator_service.dart
index d912f826..3dbfabd4 100644
--- a/lib/core/locator_service.dart
+++ b/lib/core/locator_service.dart
@@ -36,6 +36,9 @@ import 'package:eatvio_app/features/blog_post_create/services/blog_post_service.
import 'package:eatvio_app/features/bottom_navigation_bar/presentation/bloc/new_messages_cubit/new_messages_cubit.dart';
import 'package:eatvio_app/features/finances_and_consultations_archive/cubit/consultant_finances/consultant_finances_cubit.dart';
import 'package:eatvio_app/features/finances_and_consultations_archive/cubit/user_purchases/user_purchases_cubit.dart';
+import 'package:eatvio_app/features/menu/presentation/blocked_user_cubit/blocked_users_cubit.dart';
+import 'package:eatvio_app/features/menu/presentation/repositories/blocked_users_repository.dart';
+import 'package:eatvio_app/features/menu/services/blocked_users_service.dart';
import 'package:eatvio_app/features/notifications/presentation/notifications_cubit/notifications_cubit.dart';
import 'package:eatvio_app/features/bottom_navigation_bar/presentation/bloc/profile_avatar_cubit/profile_avatar_cubit.dart';
import 'package:eatvio_app/features/calendar/presentation/bloc/calendar_cubit.dart';
@@ -162,6 +165,7 @@ Future init() async {
sl.registerFactory(() => ConsultantFinancesCubit(consultationsRepository: sl()));
sl.registerFactory(() => UserPurchasesCubit(consultationsRepository: sl()));
sl.registerFactory(() => ResetPasswordCubit(resetPasswordRepository: sl()));
+ sl.registerFactory(() => BlockedUsersCubit(blockedUsersRepository: sl()));
// Repository
sl.registerLazySingleton(() => ChatRepository(chatService: sl()));
@@ -191,6 +195,7 @@ Future init() async {
sl.registerLazySingleton(() => NotificationsRepository(notificationsService: sl()));
sl.registerFactory(() => MyRecipesRepository(myRecipesService: sl()));
sl.registerFactory(() => ResetPasswordRepository(resetPasswordService: sl()));
+ sl.registerLazySingleton(() => BlockedUsersRepository(blockedUserService: sl()));
// Services
sl.registerLazySingleton(() => ChatService(sl()));
@@ -222,6 +227,7 @@ Future init() async {
sl.registerLazySingleton(() => MyRecipesService(sl()));
sl.registerLazySingleton(() => FirebaseApi());
sl.registerLazySingleton(() => ResetPasswordService(sl()));
+ sl.registerLazySingleton(() => BlockedUserService(sl()));
// External
sl.registerLazySingleton(
diff --git a/lib/core/widgets/custom_popup.dart b/lib/core/widgets/custom_popup.dart
index dbe04ec4..1ba0224e 100644
--- a/lib/core/widgets/custom_popup.dart
+++ b/lib/core/widgets/custom_popup.dart
@@ -11,6 +11,7 @@ import 'package:eatvio_app/features/feed/models/feed_blog_post_model.dart';
import 'package:eatvio_app/features/feed/models/recipes_model.dart';
import 'package:eatvio_app/features/feed/presentation/bloc/diets_cubit/diets_cubit.dart';
import 'package:eatvio_app/features/feed/presentation/bloc/recipes_cubit/recipes_cubit.dart';
+import 'package:eatvio_app/features/menu/presentation/blocked_user_cubit/blocked_users_cubit.dart';
import 'package:eatvio_app/features/my_plans/presentation/cubit/my_plans_cubit.dart';
import 'package:eatvio_app/generated/l10n.dart';
import 'package:flutter/material.dart';
@@ -28,6 +29,7 @@ class CustomPopup extends StatelessWidget {
final FeedBlogPostModel? feedBlogPostModel;
final Recipe? recipe;
final Diet? diet;
+ final String userSlug;
const CustomPopup({
super.key,
@@ -39,6 +41,7 @@ class CustomPopup extends StatelessWidget {
this.feedBlogPostModel,
this.recipe,
this.diet,
+ required this.userSlug
});
@override
@@ -164,6 +167,13 @@ class CustomPopup extends StatelessWidget {
);
}
});
+ addItem(
+ 'assets/icons/complain.svg',
+ 'Заблокировать автора',
+ () {
+ sl().blockUser(userSlug);
+ },
+ );
}
if (entries.isNotEmpty && entries.last is PopupMenuItem) {
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 f597c244..580e89f0 100644
--- a/lib/features/blog_post/presentation/pages/blog_post_screen.dart
+++ b/lib/features/blog_post/presentation/pages/blog_post_screen.dart
@@ -166,6 +166,7 @@ class _BlogPostScreenState extends State {
path: 'blog_post/${(widget.blogPost.id)}',
id: widget.blogPost.id,
feedBlogPostModel: widget.blogPost,
+ userSlug: widget.blogPost.author.authorSlug,
),
const SizedBox(width: 16),
],
diff --git a/lib/features/create_diet/presentation/diet_preview_screen.dart b/lib/features/create_diet/presentation/diet_preview_screen.dart
index 3901841f..fa88e9d8 100644
--- a/lib/features/create_diet/presentation/diet_preview_screen.dart
+++ b/lib/features/create_diet/presentation/diet_preview_screen.dart
@@ -194,6 +194,7 @@ class _DietPreviewScreenState extends State {
isAuthor: widget.diet.author.authorIsMe,
path: 'diet/${widget.diet.slug}',
complainedContentType: ComplainedContent.diet,
+ userSlug: widget.diet.author.authorSlug,
),
const SizedBox(width: 16),
],
diff --git a/lib/features/diets/presentation/pages/about_diet_screen.dart b/lib/features/diets/presentation/pages/about_diet_screen.dart
index 2252324e..f8c8fa97 100644
--- a/lib/features/diets/presentation/pages/about_diet_screen.dart
+++ b/lib/features/diets/presentation/pages/about_diet_screen.dart
@@ -322,6 +322,7 @@ class _AboutDietScreenState extends State {
complainedContentType: ComplainedContent.diet,
id: widget.diet.id,
diet: widget.diet,
+ userSlug: widget.diet.author.authorSlug,
),
const SizedBox(width: 16),
],
@@ -503,6 +504,7 @@ class _AboutDietScreenState extends State {
complainedContentType: ComplainedContent.diet,
id: widget.diet.id,
diet: widget.diet,
+ userSlug: widget.diet.author.authorSlug,
),
const SizedBox(width: 16),
],
@@ -530,6 +532,7 @@ class _AboutDietScreenState extends State {
complainedContentType: ComplainedContent.diet,
id: widget.diet.id,
diet: widget.diet,
+ userSlug: widget.diet.author.authorSlug,
),
const SizedBox(width: 16),
],
diff --git a/lib/features/feed/presentation/widgets/blog_post_widget.dart b/lib/features/feed/presentation/widgets/blog_post_widget.dart
index b349f8fa..c6eac244 100644
--- a/lib/features/feed/presentation/widgets/blog_post_widget.dart
+++ b/lib/features/feed/presentation/widgets/blog_post_widget.dart
@@ -130,6 +130,7 @@ class _BlogPostWidgetState extends State {
path: 'blog_post/${(state.feedBlogPostList[widget.index].id)}',
id: state.feedBlogPostList[widget.index].id,
feedBlogPostModel: state.feedBlogPostList[widget.index],
+ userSlug: state.feedBlogPostList[widget.index].author.authorSlug,
),
],
),
diff --git a/lib/features/feed/presentation/widgets/diets_widget.dart b/lib/features/feed/presentation/widgets/diets_widget.dart
index 3b0a7662..d008e3c4 100644
--- a/lib/features/feed/presentation/widgets/diets_widget.dart
+++ b/lib/features/feed/presentation/widgets/diets_widget.dart
@@ -94,6 +94,7 @@ class _DietsWidgetState extends State {
id: widget.diet.id,
complainedContentType: ComplainedContent.diet,
diet: widget.diet,
+ userSlug: widget.diet.author.authorSlug,
),
),
),
diff --git a/lib/features/feed/presentation/widgets/plan_widget.dart b/lib/features/feed/presentation/widgets/plan_widget.dart
index 8a8229b8..35bd9d63 100644
--- a/lib/features/feed/presentation/widgets/plan_widget.dart
+++ b/lib/features/feed/presentation/widgets/plan_widget.dart
@@ -100,6 +100,7 @@ class _PlanWidgetState extends State {
id: widget.plan.id,
slug: widget.plan.slug,
complainedContentType: ComplainedContent.plan,
+ userSlug: widget.plan.author.authorSlug,
),
),
),
diff --git a/lib/features/feed/presentation/widgets/recipes_widget.dart b/lib/features/feed/presentation/widgets/recipes_widget.dart
index 47a8ab0f..797c0599 100644
--- a/lib/features/feed/presentation/widgets/recipes_widget.dart
+++ b/lib/features/feed/presentation/widgets/recipes_widget.dart
@@ -128,6 +128,7 @@ class _RecipesWidgetState extends State {
slug: widget.recipe.slug,
complainedContentType: ComplainedContent.recipe,
recipe: widget.recipe,
+ userSlug: widget.recipe.author.authorSlug,
),
),
),
diff --git a/lib/features/menu/models/blocked_users_model.dart b/lib/features/menu/models/blocked_users_model.dart
new file mode 100644
index 00000000..a7abd7f6
--- /dev/null
+++ b/lib/features/menu/models/blocked_users_model.dart
@@ -0,0 +1,14 @@
+import 'package:eatvio_app/features/profile/models/profile_model.dart';
+import 'package:freezed_annotation/freezed_annotation.dart';
+
+part 'blocked_users_model.g.dart';
+part 'blocked_users_model.freezed.dart';
+
+@freezed
+abstract class BlockedUsersModel with _$BlockedUsersModel {
+ const factory BlockedUsersModel({
+ @JsonKey(name: 'data') required List profilesList,
+ }) = _BlockedUsersModel;
+
+ factory BlockedUsersModel.fromJson(Map json) => _$BlockedUsersModelFromJson(json);
+}
diff --git a/lib/features/menu/presentation/blocked_user_cubit/blocked_users_cubit.dart b/lib/features/menu/presentation/blocked_user_cubit/blocked_users_cubit.dart
new file mode 100644
index 00000000..bd2a156d
--- /dev/null
+++ b/lib/features/menu/presentation/blocked_user_cubit/blocked_users_cubit.dart
@@ -0,0 +1,29 @@
+import 'package:eatvio_app/features/menu/presentation/blocked_user_cubit/blocked_users_state.dart';
+import 'package:eatvio_app/features/menu/presentation/repositories/blocked_users_repository.dart';
+import 'package:flutter_bloc/flutter_bloc.dart';
+
+class BlockedUsersCubit extends Cubit {
+ final BlockedUsersRepository blockedUsersRepository;
+
+ BlockedUsersCubit({
+ required this.blockedUsersRepository,
+ }) : super(const BlockedUsersState());
+
+ getBlockedUsers() async {
+ try {
+ emit(BlockedUsersState.loaded(profilesList: await blockedUsersRepository.getBlockedUsers()));
+ } catch (e, st) {
+ emit(BlockedUsersState.error(errorMessage: '$e $st'));
+ }
+ }
+
+ blockUser(String slug) async {
+ await blockedUsersRepository.blockUserBySlug(slug);
+ await getBlockedUsers();
+ }
+
+ unblockUser(String slug) async {
+ await blockedUsersRepository.unblockUserBySlug(slug);
+ await getBlockedUsers();
+ }
+}
diff --git a/lib/features/menu/presentation/blocked_user_cubit/blocked_users_state.dart b/lib/features/menu/presentation/blocked_user_cubit/blocked_users_state.dart
new file mode 100644
index 00000000..2d83cdc6
--- /dev/null
+++ b/lib/features/menu/presentation/blocked_user_cubit/blocked_users_state.dart
@@ -0,0 +1,15 @@
+import 'package:eatvio_app/features/profile/models/profile_model.dart';
+import 'package:flutter/foundation.dart';
+import 'package:freezed_annotation/freezed_annotation.dart';
+
+part 'blocked_users_state.freezed.dart';
+
+@freezed
+abstract class BlockedUsersState with _$BlockedUsersState {
+ const factory BlockedUsersState() = _BlockedUsersState;
+ const factory BlockedUsersState.loading() = BlockedUsersStateLoading;
+ const factory BlockedUsersState.loaded({required List profilesList}) = BlockedUsersStateLoaded;
+ const factory BlockedUsersState.error({
+ required String errorMessage,
+ }) = BlockedUsersStateError;
+}
diff --git a/lib/features/menu/presentation/pages/blocked_users_screen.dart b/lib/features/menu/presentation/pages/blocked_users_screen.dart
new file mode 100644
index 00000000..2f632026
--- /dev/null
+++ b/lib/features/menu/presentation/pages/blocked_users_screen.dart
@@ -0,0 +1,43 @@
+import 'package:eatvio_app/core/locator_service.dart';
+import 'package:eatvio_app/features/menu/presentation/blocked_user_cubit/blocked_users_cubit.dart';
+import 'package:eatvio_app/features/menu/presentation/blocked_user_cubit/blocked_users_state.dart';
+import 'package:eatvio_app/features/menu/presentation/widgets/blocked_user_widget.dart';
+import 'package:flutter/material.dart';
+import 'package:flutter_bloc/flutter_bloc.dart';
+
+class BlockedUsersScreen extends StatefulWidget {
+ const BlockedUsersScreen({super.key});
+
+ @override
+ State createState() => _BlockedUsersScreenState();
+}
+
+class _BlockedUsersScreenState extends State {
+ @override
+ Widget build(BuildContext context) {
+ return BlocProvider(
+ create: (BuildContext context) => sl()..getBlockedUsers(),
+ child: BlocBuilder(
+ builder: (BuildContext context, BlockedUsersState state) {
+ if (state is BlockedUsersStateLoaded) {
+ return Scaffold(
+ appBar: AppBar(
+ title: const Text('Чёрный список'),
+ ),
+ body: ListView.builder(
+ itemBuilder: (context, index) => BlockedUserWidget(profile: state.profilesList[index]),
+ itemCount: state.profilesList.length,
+ ),
+ );
+ } else {
+ return const Scaffold(
+ body: Center(
+ child: CircularProgressIndicator(),
+ ),
+ );
+ }
+ },
+ ),
+ );
+ }
+}
diff --git a/lib/features/menu/presentation/pages/menu_screen.dart b/lib/features/menu/presentation/pages/menu_screen.dart
index c8fa2135..0449113b 100644
--- a/lib/features/menu/presentation/pages/menu_screen.dart
+++ b/lib/features/menu/presentation/pages/menu_screen.dart
@@ -53,6 +53,8 @@ class MenuScreen extends StatelessWidget {
_tile(leading: ImageConstant.icnGlossary, title: 'Глоссарий', onTap: () => GoRouter.of(context).push('/glossary-screen')),
_divider(context),
_tile(leading: ImageConstant.icnSupport, title: 'Поддержка', onTap: () => GoRouter.of(context).push('/support-screen')),
+ _divider(context),
+ _tile(leading: 'assets/icons/blocked_users.svg', title: 'Чёрный список', onTap: () => GoRouter.of(context).pushNamed('blockedUsersScreen')),
// _divider(context),
// _tile(
// leading: ImageConstant.icnDevTools,
diff --git a/lib/features/menu/presentation/repositories/blocked_users_repository.dart b/lib/features/menu/presentation/repositories/blocked_users_repository.dart
index e69de29b..96c072c4 100644
--- a/lib/features/menu/presentation/repositories/blocked_users_repository.dart
+++ b/lib/features/menu/presentation/repositories/blocked_users_repository.dart
@@ -0,0 +1,47 @@
+import 'dart:developer';
+
+import 'package:eatvio_app/features/menu/services/blocked_users_service.dart';
+import 'package:eatvio_app/features/profile/models/profile_model.dart';
+
+class BlockedUsersRepository {
+ final BlockedUserService blockedUserService;
+
+ BlockedUsersRepository({
+ required this.blockedUserService,
+ });
+
+ Future> getBlockedUsers() async {
+ try {
+ return (await blockedUserService.getBlockedUsers()).profilesList;
+ } catch (e, st) {
+ log(e.toString(), stackTrace: st);
+ rethrow;
+ }
+ }
+
+ blockUserBySlug(String slug) async {
+ try {
+ return await blockedUserService.blockUser(
+ data: {
+ 'slug': slug,
+ },
+ );
+ } catch (e, st) {
+ log(e.toString(), stackTrace: st);
+ rethrow;
+ }
+ }
+
+ unblockUserBySlug(String slug) async {
+ try {
+ return await blockedUserService.unblockUser(
+ data: {
+ 'slug': slug,
+ },
+ );
+ } catch (e, st) {
+ log(e.toString(), stackTrace: st);
+ rethrow;
+ }
+ }
+}
diff --git a/lib/features/menu/presentation/widgets/blocked_user_widget.dart b/lib/features/menu/presentation/widgets/blocked_user_widget.dart
new file mode 100644
index 00000000..494df21c
--- /dev/null
+++ b/lib/features/menu/presentation/widgets/blocked_user_widget.dart
@@ -0,0 +1,83 @@
+import 'package:eatvio_app/core/const.dart';
+import 'package:eatvio_app/features/feed/models/diets_pagination_model.dart';
+import 'package:eatvio_app/features/menu/presentation/blocked_user_cubit/blocked_users_cubit.dart';
+import 'package:eatvio_app/features/profile/models/profile_model.dart';
+import 'package:flutter/material.dart';
+import 'package:flutter_bloc/flutter_bloc.dart';
+import 'package:go_router/go_router.dart';
+
+class BlockedUserWidget extends StatefulWidget {
+ final ProfileModel profile;
+ const BlockedUserWidget({super.key, required this.profile});
+
+ @override
+ State createState() => _BlockedUserWidgetState();
+}
+
+class _BlockedUserWidgetState extends State {
+ @override
+ Widget build(BuildContext context) {
+ return InkWell(
+ onTap: () => GoRouter.of(context).pushNamed(
+ 'profileScreen',
+ extra: Author(
+ authorSlug: widget.profile.slug,
+ authorName: widget.profile.name,
+ authorProfileIcon: widget.profile.profilePhotoUrl,
+ authorIsMe: false,
+ isEntitySubscribedByMe: false,
+ ),
+ ),
+ child: Ink(
+ padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 16),
+ child: Row(
+ children: [
+ CircleAvatar(
+ foregroundImage: NetworkImage(baseUrl + widget.profile.profilePhotoUrl),
+ backgroundImage: const AssetImage('assets/images/no_avatar.png'),
+ radius: 28,
+ ),
+ const SizedBox(width: 12),
+ Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ Text(
+ widget.profile.name,
+ style: const TextStyle(
+ color: Color(0xFF323F4B),
+ fontSize: 16,
+ fontWeight: FontWeight.w600,
+ height: 1,
+ ),
+ ),
+ ],
+ ),
+ const Spacer(),
+ InkWell(
+ onTap: () {
+ context.read().unblockUser(widget.profile.slug);
+ },
+ borderRadius: BorderRadius.circular(4),
+ child: Ink(
+ padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
+ decoration: BoxDecoration(
+ color: const Color(0xFFF1F2F6),
+ borderRadius: BorderRadius.circular(4),
+ ),
+ child: const Text(
+ 'Убрать',
+ style: TextStyle(
+ fontSize: 12,
+ fontWeight: FontWeight.w600,
+ color: Color(0xFF6D6F71),
+ ),
+ ),
+ ),
+ ),
+ ],
+ ),
+ ),
+ );
+ }
+}
diff --git a/lib/features/menu/services/blocked_users_service.dart b/lib/features/menu/services/blocked_users_service.dart
index 590d979f..6a4ed987 100644
--- a/lib/features/menu/services/blocked_users_service.dart
+++ b/lib/features/menu/services/blocked_users_service.dart
@@ -1,4 +1,5 @@
import 'package:dio/dio.dart';
+import 'package:eatvio_app/features/menu/models/blocked_users_model.dart';
import 'package:retrofit/retrofit.dart';
part 'blocked_users_service.g.dart';
@@ -8,17 +9,15 @@ abstract class BlockedUserService {
factory BlockedUserService(Dio dio, {String baseUrl}) = _BlockedUserService;
@GET('/api/blocked_users')
- Future getBlockedUsers();
+ Future getBlockedUsers();
@POST('/api/blocked_users/block')
Future blockUser({
- String? slug,
- String? id,
+ @Body() required Map data,
});
@POST('/api/blocked_users/unblock')
Future unblockUser({
- String? slug,
- String? id,
+ @Body() required Map data,
});
}
diff --git a/lib/features/plans/presentation/pages/about_plan_screen.dart b/lib/features/plans/presentation/pages/about_plan_screen.dart
index 6b8980cf..4e33f0df 100644
--- a/lib/features/plans/presentation/pages/about_plan_screen.dart
+++ b/lib/features/plans/presentation/pages/about_plan_screen.dart
@@ -116,6 +116,7 @@ class _AboutPlanScreenState extends State {
path: 'plan/${widget.plan.slug}',
complainedContentType: ComplainedContent.plan,
slug: widget.plan.slug,
+ userSlug: widget.plan.author.authorSlug,
),
const SizedBox(width: 16),
],
@@ -146,6 +147,7 @@ class _AboutPlanScreenState extends State {
path: 'plan/${widget.plan.slug}',
complainedContentType: ComplainedContent.plan,
slug: widget.plan.slug,
+ userSlug: widget.plan.author.authorSlug,
),
const SizedBox(width: 16),
],
@@ -365,6 +367,7 @@ class _AboutPlanScreenState extends State {
path: 'plan/${widget.plan.slug}',
complainedContentType: ComplainedContent.plan,
slug: widget.plan.slug,
+ userSlug: widget.plan.author.authorSlug,
),
const SizedBox(width: 16),
],
diff --git a/lib/features/profile/presentation/pages/profile_screen.dart b/lib/features/profile/presentation/pages/profile_screen.dart
index 9dc4f880..d475d34b 100644
--- a/lib/features/profile/presentation/pages/profile_screen.dart
+++ b/lib/features/profile/presentation/pages/profile_screen.dart
@@ -14,6 +14,7 @@ import 'package:eatvio_app/features/chat/presentation/pages/photo_view_screen.da
import 'package:eatvio_app/features/complaining/presentation/complaining_bottom_sheet.dart';
import 'package:eatvio_app/features/feed/models/diets_pagination_model.dart';
import 'package:eatvio_app/features/feed/presentation/widgets/plan_widget.dart';
+import 'package:eatvio_app/features/menu/presentation/blocked_user_cubit/blocked_users_cubit.dart';
import 'package:eatvio_app/features/profile/models/circumference_model.dart';
import 'package:eatvio_app/features/profile/models/weight_model.dart';
import 'package:eatvio_app/features/profile/presentation/bloc/plans_cubit/plans_cubit.dart';
@@ -1175,6 +1176,8 @@ class _ProfileScreenState extends State {
sharePositionOrigin: box!.localToGlobal(Offset.zero) & box.size,
),
);
+ } else if (value == 'block') {
+ sl().blockUser(state.profile.slug);
} else {
showModalBottomSheet(
context: context,
@@ -1196,6 +1199,11 @@ class _ProfileScreenState extends State {
value: 'complain',
child: Text('Пожаловаться'),
),
+ if (widget.author != null)
+ const PopupMenuItem(
+ value: 'block',
+ child: Text('Заблокировать'),
+ ),
],
child: const Icon(Icons.more_horiz_rounded),
),
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 5ac4d60e..68c29a0a 100644
--- a/lib/features/profile/presentation/widgets/profile_blog_post_widget.dart
+++ b/lib/features/profile/presentation/widgets/profile_blog_post_widget.dart
@@ -102,6 +102,7 @@ class _ProfileBlogPostWidgetState extends State {
path: 'blog_post/${(state.blogPosts[widget.index].id)}',
id: state.blogPosts[widget.index].id,
feedBlogPostModel: state.blogPosts[widget.index],
+ userSlug: state.blogPosts[widget.index].author.authorSlug,
),
],
),
diff --git a/lib/features/recipe/presentation/pages/about_recipe_screen.dart b/lib/features/recipe/presentation/pages/about_recipe_screen.dart
index 6906b3da..36051709 100644
--- a/lib/features/recipe/presentation/pages/about_recipe_screen.dart
+++ b/lib/features/recipe/presentation/pages/about_recipe_screen.dart
@@ -219,6 +219,7 @@ class _AboutRecipeScreenState extends State {
complainedContentType: ComplainedContent.recipe,
slug: widget.recipe.slug,
recipe: widget.recipe,
+ userSlug: widget.recipe.author.authorSlug,
),
const SizedBox(width: 16),
],
@@ -403,6 +404,7 @@ class _AboutRecipeScreenState extends State {
complainedContentType: ComplainedContent.recipe,
slug: widget.recipe.slug,
recipe: widget.recipe,
+ userSlug: widget.recipe.author.authorSlug,
),
const SizedBox(width: 16),
],
@@ -428,6 +430,7 @@ class _AboutRecipeScreenState extends State {
complainedContentType: ComplainedContent.recipe,
slug: widget.recipe.slug,
recipe: widget.recipe,
+ userSlug: widget.recipe.author.authorSlug,
),
const SizedBox(width: 16),
],