mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-05-30 23:58:13 +08:00
@@ -104,6 +104,8 @@ class DynamicItemModel {
|
|||||||
String? type;
|
String? type;
|
||||||
bool? visible;
|
bool? visible;
|
||||||
|
|
||||||
|
late bool linkFolded = false;
|
||||||
|
|
||||||
// opus
|
// opus
|
||||||
Fallback? fallback;
|
Fallback? fallback;
|
||||||
|
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -221,6 +221,10 @@ abstract final class PageUtils {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
if (item.linkFolded) {
|
||||||
|
pushDynFromId(id: item.idStr);
|
||||||
|
return;
|
||||||
|
}
|
||||||
toDupNamed(
|
toDupNamed(
|
||||||
'/dynamicDetail',
|
'/dynamicDetail',
|
||||||
arguments: {
|
arguments: {
|
||||||
|
|||||||
Reference in New Issue
Block a user