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;
bool? visible;
late bool linkFolded = false;
// opus
Fallback? fallback;

View File

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

View File

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