From 5242ef08701184e08783326de7d9d68b514c24f9 Mon Sep 17 00:00:00 2001 From: zhx Date: Mon, 25 May 2026 19:55:48 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8D=A1=E7=89=87=E6=B6=88?= =?UTF-8?q?=E5=A4=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/modules/chat/message_chat_page.dart | 153 +++++++++++++----------- 1 file changed, 82 insertions(+), 71 deletions(-) diff --git a/lib/modules/chat/message_chat_page.dart b/lib/modules/chat/message_chat_page.dart index 0bf2296..aa19a22 100644 --- a/lib/modules/chat/message_chat_page.dart +++ b/lib/modules/chat/message_chat_page.dart @@ -1250,7 +1250,10 @@ class _MessageItem extends StatelessWidget { _isDuplicateCpInviteMessageForConversation(customData)) { return const SizedBox.shrink(); } - final cpRelationFormedCard = _cpRelationFormedMessageCard(); + final isCpInviteMessage = + customData != null && _isCpInvitePayload(customData); + final cpRelationFormedCard = + isCpInviteMessage ? null : _cpRelationFormedMessageCard(); final cpStatusLineText = _cpStatusLineTextForMessage(); return Container( margin: EdgeInsets.symmetric(horizontal: 15.w, vertical: 8.w), @@ -1304,77 +1307,85 @@ class _MessageItem extends StatelessWidget { ), child: cpRelationFormedCard, ) - else if (cpStatusLineText == null) - Row( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - textDirection: - message.isSelf! ? TextDirection.rtl : TextDirection.ltr, - children: [ - GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - if (isSystem) { - return; - } - SCNavigatorUtils.push( - context, - replace: - AccountStorage().getCurrentUser()?.userProfile?.id != - message.sender, - "${SCMainRoute.person}?isMe=${AccountStorage().getCurrentUser()?.userProfile?.id == message.sender}&tageId=${message.sender}", - ); - }, - child: - message.sender == "administrator" || - message.sender == "customer" - ? ExtendedImage.asset( - _strategy.getSCMessageChatPageSystemHeadImage(), - width: 45.w, - shape: BoxShape.circle, - fit: BoxFit.cover, - ) - : netImage( - url: - message.isSelf! - ? (me?.userAvatar ?? "") - : (friend?.userAvatar ?? ""), - shape: BoxShape.circle, - width: width(45), - ), - ), - // 他人消息的阴影间隔是10dp - Container(width: 8.w), - Row( - textDirection: - message.isSelf! ? TextDirection.rtl : TextDirection.ltr, - children: [ - Container( - alignment: - message.isSelf! - ? AlignmentDirectional.topEnd - : AlignmentDirectional.topStart, - margin: EdgeInsets.only(top: 4.w), - child: _msg(), - ), - SizedBox(width: 6.w), - Visibility( - visible: - message.status == - MessageStatus.V2TIM_MSG_STATUS_SENDING, - child: CupertinoActivityIndicator(), - ), + else if (cpStatusLineText == null || isCpInviteMessage) + Padding( + padding: EdgeInsets.only( + top: cpStatusLineText == null ? 0 : 10.w, + ), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + textDirection: + message.isSelf! ? TextDirection.rtl : TextDirection.ltr, + children: [ + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + if (isSystem) { + return; + } + SCNavigatorUtils.push( + context, + replace: + AccountStorage() + .getCurrentUser() + ?.userProfile + ?.id != + message.sender, + "${SCMainRoute.person}?isMe=${AccountStorage().getCurrentUser()?.userProfile?.id == message.sender}&tageId=${message.sender}", + ); + }, + child: + message.sender == "administrator" || + message.sender == "customer" + ? ExtendedImage.asset( + _strategy.getSCMessageChatPageSystemHeadImage(), + width: 45.w, + shape: BoxShape.circle, + fit: BoxFit.cover, + ) + : netImage( + url: + message.isSelf! + ? (me?.userAvatar ?? "") + : (friend?.userAvatar ?? ""), + shape: BoxShape.circle, + width: width(45), + ), + ), + // 他人消息的阴影间隔是10dp + Container(width: 8.w), + Row( + textDirection: + message.isSelf! ? TextDirection.rtl : TextDirection.ltr, + children: [ + Container( + alignment: + message.isSelf! + ? AlignmentDirectional.topEnd + : AlignmentDirectional.topStart, + margin: EdgeInsets.only(top: 4.w), + child: _msg(), + ), + SizedBox(width: 6.w), + Visibility( + visible: + message.status == + MessageStatus.V2TIM_MSG_STATUS_SENDING, + child: CupertinoActivityIndicator(), + ), - Visibility( - visible: - message.status == - MessageStatus.V2TIM_MSG_STATUS_SEND_FAIL, - child: Icon(Icons.error, color: Colors.red), - ), - ], - ), - Spacer(), - ], + Visibility( + visible: + message.status == + MessageStatus.V2TIM_MSG_STATUS_SEND_FAIL, + child: Icon(Icons.error, color: Colors.red), + ), + ], + ), + Spacer(), + ], + ), ), ], ),