🐛 Bug fixes and optimization

This commit is contained in:
2024-06-09 23:00:11 +08:00
parent 0f24ac03f7
commit 88c99b7467
14 changed files with 63 additions and 26 deletions

View File

@ -100,7 +100,17 @@ class ChatMessage extends StatelessWidget {
if (isContentPreviewing) {
widget = buildContent();
} else if (isMerged) {
widget = buildContent().paddingOnly(left: 52);
widget = Column(
children: [
buildContent().paddingOnly(left: 52),
if (item.attachments?.isNotEmpty ?? false)
AttachmentList(
key: Key('m${item.uuid}attachments'),
parentId: item.uuid,
attachmentsId: item.attachments ?? List.empty(),
).paddingSymmetric(vertical: 4),
],
);
} else if (isReply) {
widget = Row(
mainAxisAlignment: MainAxisAlignment.center,
@ -149,6 +159,7 @@ class ChatMessage extends StatelessWidget {
).paddingSymmetric(horizontal: 12),
if (item.attachments?.isNotEmpty ?? false)
AttachmentList(
key: Key('m${item.uuid}attachments'),
parentId: item.uuid,
attachmentsId: item.attachments ?? List.empty(),
).paddingSymmetric(vertical: 4),

View File

@ -75,7 +75,7 @@ class _ChatMessageInputState extends State<ChatMessageInput> {
'uuid': const Uuid().v4(),
'type': 'm.text',
'content': encodeMessage(_textController.value.text),
'attachments': _attachments,
'attachments': List.from(_attachments),
'reply_to': _replyTo?.id,
};
@ -96,6 +96,7 @@ class _ChatMessageInputState extends State<ChatMessageInput> {
updatedAt: DateTime.now(),
content: payload['content'] as Map<String, dynamic>,
type: payload['type'] as String,
attachments: _attachments,
sender: sender,
replyId: _replyTo?.id,
replyTo: _replyTo,