From 0b5397ec00ef148e08c54a5a40b71b636c1c715a Mon Sep 17 00:00:00 2001 From: guozhigq Date: Wed, 28 Feb 2024 23:29:02 +0800 Subject: [PATCH 1/4] =?UTF-8?q?fix:=20=E5=8A=A8=E6=80=81=E8=AF=84=E8=AE=BA?= =?UTF-8?q?=E5=8C=BAseek=20error?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../detail/reply/widgets/reply_item.dart | 32 ++++++++++++------- 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/lib/pages/video/detail/reply/widgets/reply_item.dart b/lib/pages/video/detail/reply/widgets/reply_item.dart index 246d0688..ab385c0e 100644 --- a/lib/pages/video/detail/reply/widgets/reply_item.dart +++ b/lib/pages/video/detail/reply/widgets/reply_item.dart @@ -462,6 +462,9 @@ class ReplyItemRow extends StatelessWidget { InlineSpan buildContent( BuildContext context, replyItem, replyReply, fReplyItem) { + final String routePath = Get.currentRoute; + bool isVideoPage = routePath.startsWith('/video/detail'); + // replyItem 当前回复内容 // replyReply 查看二楼回复(回复详情)回调 // fReplyItem 父级回复内容,用作二楼回复(回复详情)展示 @@ -571,21 +574,26 @@ InlineSpan buildContent( spanChilds.add( TextSpan( text: ' $matchStr ', - style: TextStyle( - color: Theme.of(context).colorScheme.primary, - ), + style: isVideoPage + ? TextStyle( + color: Theme.of(context).colorScheme.primary, + ) + : null, recognizer: TapGestureRecognizer() ..onTap = () { // 跳转到指定位置 - try { - SmartDialog.showToast('跳转至:$matchStr'); - Get.find(tag: Get.arguments['heroTag']) - .plPlayerController - .seekTo( - Duration(seconds: Utils.duration(matchStr)), - ); - } catch (e) { - SmartDialog.showToast('跳转失败: $e'); + if (isVideoPage) { + try { + SmartDialog.showToast('跳转至:$matchStr'); + Get.find( + tag: Get.arguments['heroTag']) + .plPlayerController + .seekTo( + Duration(seconds: Utils.duration(matchStr)), + ); + } catch (e) { + SmartDialog.showToast('跳转失败: $e'); + } } }, ), From a9d73a9f1ba1749461b4e3132cd090993ab26023 Mon Sep 17 00:00:00 2001 From: guozhigq Date: Wed, 28 Feb 2024 23:51:30 +0800 Subject: [PATCH 2/4] =?UTF-8?q?fix:=20=E5=8A=A8=E6=80=81=E6=A0=87=E9=A2=98?= =?UTF-8?q?=E6=9C=AA=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/pages/dynamics/widgets/content_panel.dart | 4 +++- lib/pages/dynamics/widgets/rich_node_panel.dart | 11 +++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/lib/pages/dynamics/widgets/content_panel.dart b/lib/pages/dynamics/widgets/content_panel.dart index d10804d7..e1beaeb2 100644 --- a/lib/pages/dynamics/widgets/content_panel.dart +++ b/lib/pages/dynamics/widgets/content_panel.dart @@ -45,7 +45,9 @@ class _ContentState extends State { if (len == 1) { OpusPicsModel pictureItem = pics.first; picList.add(pictureItem.url!); - spanChilds.add(const TextSpan(text: '\n')); + + /// 图片上方的空白间隔 + // spanChilds.add(const TextSpan(text: '\n')); spanChilds.add( WidgetSpan( child: LayoutBuilder( diff --git a/lib/pages/dynamics/widgets/rich_node_panel.dart b/lib/pages/dynamics/widgets/rich_node_panel.dart index 8f744dd5..5ffee5f1 100644 --- a/lib/pages/dynamics/widgets/rich_node_panel.dart +++ b/lib/pages/dynamics/widgets/rich_node_panel.dart @@ -19,6 +19,17 @@ InlineSpan richNode(item, context) { // 动态页面 richTextNodes 层级可能与主页动态层级不同 richTextNodes = item.modules.moduleDynamic.major.opus.summary.richTextNodes; + if (item.modules.moduleDynamic.major.opus.title != null) { + spanChilds.add( + TextSpan( + text: item.modules.moduleDynamic.major.opus.title + '\n', + style: Theme.of(context) + .textTheme + .titleMedium! + .copyWith(fontWeight: FontWeight.bold), + ), + ); + } } if (richTextNodes == null || richTextNodes.isEmpty) { return spacer; From 0b0db1a2b17c056744bc28cf7d4d4f38f0501ade Mon Sep 17 00:00:00 2001 From: guozhigq Date: Wed, 28 Feb 2024 23:59:47 +0800 Subject: [PATCH 3/4] =?UTF-8?q?mod:=20videoPage=20path=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/pages/video/detail/reply/widgets/reply_item.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pages/video/detail/reply/widgets/reply_item.dart b/lib/pages/video/detail/reply/widgets/reply_item.dart index ab385c0e..4232d4e9 100644 --- a/lib/pages/video/detail/reply/widgets/reply_item.dart +++ b/lib/pages/video/detail/reply/widgets/reply_item.dart @@ -463,7 +463,7 @@ class ReplyItemRow extends StatelessWidget { InlineSpan buildContent( BuildContext context, replyItem, replyReply, fReplyItem) { final String routePath = Get.currentRoute; - bool isVideoPage = routePath.startsWith('/video/detail'); + bool isVideoPage = routePath.startsWith('/video'); // replyItem 当前回复内容 // replyReply 查看二楼回复(回复详情)回调 From 33ef18ef1d23bbcc90022aec95f9c8cc4aed1891 Mon Sep 17 00:00:00 2001 From: guozhigq Date: Thu, 29 Feb 2024 00:30:55 +0800 Subject: [PATCH 4/4] =?UTF-8?q?fix:=20=E8=AF=84=E8=AE=BAjumpUrl=E6=AD=A3?= =?UTF-8?q?=E5=88=99=E8=BD=AC=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/pages/video/detail/reply/widgets/reply_item.dart | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/pages/video/detail/reply/widgets/reply_item.dart b/lib/pages/video/detail/reply/widgets/reply_item.dart index 4232d4e9..c55380f2 100644 --- a/lib/pages/video/detail/reply/widgets/reply_item.dart +++ b/lib/pages/video/detail/reply/widgets/reply_item.dart @@ -506,21 +506,25 @@ InlineSpan buildContent( .replaceAll('"', '"') .replaceAll(''', "'") .replaceAll(' ', ' '); - // print("content.jumpUrl.keys:" + content.jumpUrl.keys.toString()); // 构建正则表达式 final List specialTokens = [ ...content.emote.keys, ...content.topicsMeta?.keys?.map((e) => '#$e#') ?? [], ...content.atNameToMid.keys.map((e) => '@$e'), - ...content.jumpUrl.keys.map((e) => - e.replaceAll('?', '\\?').replaceAll('+', '\\+').replaceAll('*', '\\*')), ]; + List jumpUrlKeysList = content.jumpUrl.keys.map((e) { + return e.replaceAllMapped( + RegExp(r'[?+*]'), (match) => '\\${match.group(0)}'); + }).toList(); String patternStr = specialTokens.map(RegExp.escape).join('|'); if (patternStr.isNotEmpty) { patternStr += "|"; } patternStr += r'(\b(?:\d+[::])?[0-5]?[0-9][::][0-5]?[0-9]\b)'; + if (jumpUrlKeysList.isNotEmpty) { + patternStr += '|${jumpUrlKeysList.join('|')}'; + } final RegExp pattern = RegExp(patternStr); List matchedStrs = []; void addPlainTextSpan(str) { @@ -599,7 +603,6 @@ InlineSpan buildContent( ), ); } else { - print("matchStr=$matchStr"); String appUrlSchema = ''; final bool enableWordRe = setting.get(SettingBoxKey.enableWordRe, defaultValue: false) as bool;