feat(chat): fix chat first message, add pick images from gallery

This commit is contained in:
mso7nueh
2025-06-23 19:46:23 +03:00
parent 85d67ba9c4
commit 75fa9ebc5c
10 changed files with 347 additions and 34 deletions

View File

@@ -5,6 +5,7 @@ import 'package:eatvio_app/core/image_compressing/image_compress_utility.dart';
import 'package:eatvio_app/core/utils/toasts.dart';
import 'package:eatvio_app/features/chat/repositories/chat_repository.dart';
import 'package:eatvio_app/features/consultant/become_consultant/repositories/consultant_repository.dart';
import 'package:eatvio_app/features/feed/models/diets_pagination_model.dart';
import 'package:eatvio_app/features/feed/models/feed_blog_post_model.dart';
import 'package:eatvio_app/features/profile/presentation/bloc/profile_cubit/profile_state.dart';
import 'package:eatvio_app/features/profile/repositories/profile_repository.dart';
@@ -107,18 +108,14 @@ class ProfileCubit extends Cubit<ProfileState> {
}
getChatRoomIdBySlug({
required String slug,
required Author author,
}) async {
try {
final chatIdOrError = await chatRepository.getChatByUserSlug(slug);
final chatIdOrError = await chatRepository.getChatByUserSlug(author.authorSlug);
if (chatIdOrError == '404') {
await chatRepository.sendFirstChatMessageForCreateChatRoom(slug);
final chatIdOrError = await chatRepository.getChatByUserSlug(slug);
AppRouter.navigatorKey.currentContext?.pushNamed(
'chatScreen',
extra: {
'chatId': chatIdOrError,
},
'emptyChatScreen',
extra: author,
);
} else if (chatIdOrError == 'error') {
showErrorToast('Ошибка создания чата');