feat(chat): refactor

This commit is contained in:
mso7nueh
2024-08-16 17:31:02 +03:00
parent 8b7f2edd9f
commit 35ac41cdad
6 changed files with 24 additions and 25 deletions

View File

@@ -98,6 +98,7 @@ class ChatRoomCubit extends Cubit<ChatRoomState> {
privateChatChannel.subscribe();
privateChatChannel.bind('App\\Events\\ChatMessageUpdated').listen((event) {
print(jsonDecode(event.data));
List<ChatMessageModel> messagesList = [
ChatMessageModel.fromJson(jsonDecode(event.data)['message']),
...(state as ChatRoomStateLoaded).chatMessages,

View File

@@ -236,9 +236,9 @@ class _ChatScreenState extends State<ChatScreen> {
onTap: () {
if (textEditingController.text.isNotEmpty) {
context.read<ChatRoomCubit>().sendMessage(
chatId: widget.chatId,
data: textEditingController.text.trim(),
);
chatId: widget.chatId,
data: textEditingController.text.trim(),
);
setState(() {
textEditingController.clear();
});