fix dyn folded link

Signed-off-by: dom <githubaccount56556@proton.me>
This commit is contained in:
dom
2026-03-14 12:20:41 +08:00
parent 9489d8a7ca
commit b0c6e2f5cd
3 changed files with 19 additions and 4 deletions

View File

@@ -104,6 +104,8 @@ class DynamicItemModel {
String? type; String? type;
bool? visible; bool? visible;
late bool linkFolded = false;
// opus // opus
Fallback? fallback; Fallback? fallback;

View File

@@ -17,6 +17,8 @@ import 'package:flutter/material.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
const _linkFoldedText = '网页链接';
// 富文本 // 富文本
TextSpan? richNode( TextSpan? richNode(
BuildContext context, { BuildContext context, {
@@ -63,6 +65,9 @@ TextSpan? richNode(
for (final i in richTextNodes) { for (final i in richTextNodes) {
switch (i.type) { switch (i.type) {
case 'RICH_TEXT_NODE_TYPE_TEXT': case 'RICH_TEXT_NODE_TYPE_TEXT':
if (i.origText == _linkFoldedText) {
item.linkFolded = true;
}
spanChildren.add( spanChildren.add(
TextSpan( TextSpan(
text: i.origText, text: i.origText,
@@ -102,6 +107,10 @@ TextSpan? richNode(
break; break;
// 网页链接 // 网页链接
case 'RICH_TEXT_NODE_TYPE_WEB': case 'RICH_TEXT_NODE_TYPE_WEB':
final hasLink = i.jumpUrl?.isNotEmpty ?? false;
if (!hasLink) {
item.linkFolded = true;
}
spanChildren spanChildren
..add( ..add(
WidgetSpan( WidgetSpan(
@@ -117,10 +126,10 @@ TextSpan? richNode(
TextSpan( TextSpan(
text: i.text, text: i.text,
style: style, style: style,
recognizer: i.origText == null recognizer: hasLink
? null ? (NoDeadlineTapGestureRecognizer()
: (NoDeadlineTapGestureRecognizer() ..onTap = () => PageUtils.handleWebview(i.jumpUrl!))
..onTap = () => PageUtils.handleWebview(i.origText!)), : null,
), ),
); );
break; break;

View File

@@ -221,6 +221,10 @@ abstract final class PageUtils {
}, },
); );
} else { } else {
if (item.linkFolded) {
pushDynFromId(id: item.idStr);
return;
}
toDupNamed( toDupNamed(
'/dynamicDetail', '/dynamicDetail',
arguments: { arguments: {