From fb2a55a9094f0d8a67f40f0fddbe92b12613949e Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Wed, 8 Jan 2025 17:48:46 +0800 Subject: [PATCH] :bug: Fix editing message did not load the attachment --- lib/widgets/chat/chat_message_input.dart | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/widgets/chat/chat_message_input.dart b/lib/widgets/chat/chat_message_input.dart index b8c443b..0565e1b 100644 --- a/lib/widgets/chat/chat_message_input.dart +++ b/lib/widgets/chat/chat_message_input.dart @@ -48,6 +48,8 @@ class ChatMessageInputState extends State { void setEdit(SnChatMessage? value) { _contentController.text = value?.body['text'] ?? ''; + _attachments.clear(); + _attachments.addAll(value?.preload?.attachments?.map((e) => PostWriteMedia(e)) ?? []); setState(() => _editingMessage = value); } @@ -199,6 +201,7 @@ class ChatMessageInputState extends State { InkWell( child: Text('cancel'.tr()), onTap: () { + _attachments.clear(); setState(() => _replyingMessage = null); }, ), @@ -238,6 +241,7 @@ class ChatMessageInputState extends State { InkWell( child: Text('cancel'.tr()), onTap: () { + _attachments.clear(); _contentController.clear(); setState(() => _editingMessage = null); },