From 88f0ab1dea02fe0b1edfe2ab0183affcb49573e8 Mon Sep 17 00:00:00 2001 From: dom Date: Thu, 4 Jun 2026 23:45:32 +0800 Subject: [PATCH] opt chat item Closes #2292 Signed-off-by: dom --- .../whisper_detail/widget/chat_item.dart | 140 +++++++++--------- 1 file changed, 71 insertions(+), 69 deletions(-) diff --git a/lib/pages/whisper_detail/widget/chat_item.dart b/lib/pages/whisper_detail/widget/chat_item.dart index d0e4af596..70a070d81 100644 --- a/lib/pages/whisper_detail/widget/chat_item.dart +++ b/lib/pages/whisper_detail/widget/chat_item.dart @@ -200,44 +200,45 @@ class ChatItem extends StatelessWidget { Widget msgTypeCommonShareCard_14(dynamic content, Color textColor) { if (content['source'] == '直播') { - return Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - GestureDetector( - onTap: () { - dynamic roomId = content['sourceID']; - if (roomId is String) { - roomId = int.parse(roomId); - } - PageUtils.toLiveRoom(roomId); - }, - child: NetworkImgLayer( + return GestureDetector( + behavior: .opaque, + onTap: () { + dynamic roomId = content['sourceID']; + if (roomId is String) { + roomId = int.parse(roomId); + } + PageUtils.toLiveRoom(roomId); + }, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + NetworkImgLayer( width: 220, height: 123.75, src: content['cover'], ), - ), - const SizedBox(height: 6), - Text( - content['title'] ?? "", - style: TextStyle( - letterSpacing: 0.6, - height: 1.5, - color: textColor, - fontWeight: FontWeight.bold, + const SizedBox(height: 6), + Text( + content['title'] ?? "", + style: TextStyle( + letterSpacing: 0.6, + height: 1.5, + color: textColor, + fontWeight: FontWeight.bold, + ), ), - ), - const SizedBox(height: 1), - Text( - '${content['author']} · 直播', - style: TextStyle( - letterSpacing: 0.6, - height: 1.5, - color: textColor.withValues(alpha: 0.6), - fontSize: 12, + const SizedBox(height: 1), + Text( + '${content['author']} · 直播', + style: TextStyle( + letterSpacing: 0.6, + height: 1.5, + color: textColor.withValues(alpha: 0.6), + fontSize: 12, + ), ), - ), - ], + ], + ), ); } else { return def(textColor); @@ -246,6 +247,7 @@ class ChatItem extends StatelessWidget { Widget msgTypeArticleCard_12(dynamic content, Color textColor) { return GestureDetector( + behavior: .opaque, onTap: () => Get.toNamed( '/articlePage', parameters: { @@ -267,7 +269,7 @@ class ChatItem extends StatelessWidget { ], ), const SizedBox(height: 6), - SelectableText( + Text( content['title'] ?? "", style: TextStyle( letterSpacing: 0.6, @@ -278,8 +280,7 @@ class ChatItem extends StatelessWidget { ), if (content['summary'] != null && content['summary'] != '') ...[ const SizedBox(height: 1), - SelectableText( - scrollPhysics: const NeverScrollableScrollPhysics(), + Text( content['summary'], style: TextStyle( letterSpacing: 0.6, @@ -570,32 +571,20 @@ class ChatItem extends StatelessWidget { 'unsupported source type: ${content['source']}', ); } - return Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - GestureDetector( - onTap: onTap, - child: NetworkImgLayer( + return GestureDetector( + onTap: onTap, + behavior: .opaque, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + NetworkImgLayer( width: 220, height: 123.75, src: content['thumb'], ), - ), - const SizedBox(height: 6), - Text( - content['title'] ?? "", - style: TextStyle( - letterSpacing: 0.6, - height: 1.5, - color: textColor, - fontWeight: FontWeight.bold, - ), - ), - if (content['source'] == 6 && - (content['headline'] as String?)?.isNotEmpty == true) ...[ - const SizedBox(height: 1), + const SizedBox(height: 6), Text( - content['headline'], + content['title'] ?? "", style: TextStyle( letterSpacing: 0.6, height: 1.5, @@ -603,20 +592,33 @@ class ChatItem extends StatelessWidget { fontWeight: FontWeight.bold, ), ), - ], - if (content['author'] != null) ...[ - const SizedBox(height: 1), - Text( - '${content['author']}${type != null ? ' · $type' : ''}', - style: TextStyle( - letterSpacing: 0.6, - height: 1.5, - color: textColor.withValues(alpha: 0.6), - fontSize: 12, + if (content['source'] == 6 && + (content['headline'] as String?)?.isNotEmpty == true) ...[ + const SizedBox(height: 1), + Text( + content['headline'], + style: TextStyle( + letterSpacing: 0.6, + height: 1.5, + color: textColor, + fontWeight: FontWeight.bold, + ), ), - ), + ], + if (content['author'] != null) ...[ + const SizedBox(height: 1), + Text( + '${content['author']}${type != null ? ' · $type' : ''}', + style: TextStyle( + letterSpacing: 0.6, + height: 1.5, + color: textColor.withValues(alpha: 0.6), + fontSize: 12, + ), + ), + ], ], - ], + ), ); } @@ -749,7 +751,7 @@ class ChatItem extends StatelessWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: [ - SelectableText( + Text( content['title'], style: theme.textTheme.titleMedium!.copyWith( fontWeight: FontWeight.bold,