Merge branch 'main' into fix
This commit is contained in:
@ -45,7 +45,9 @@ class _ContentState extends State<Content> {
|
|||||||
if (len == 1) {
|
if (len == 1) {
|
||||||
OpusPicsModel pictureItem = pics.first;
|
OpusPicsModel pictureItem = pics.first;
|
||||||
picList.add(pictureItem.url!);
|
picList.add(pictureItem.url!);
|
||||||
spanChilds.add(const TextSpan(text: '\n'));
|
|
||||||
|
/// 图片上方的空白间隔
|
||||||
|
// spanChilds.add(const TextSpan(text: '\n'));
|
||||||
spanChilds.add(
|
spanChilds.add(
|
||||||
WidgetSpan(
|
WidgetSpan(
|
||||||
child: LayoutBuilder(
|
child: LayoutBuilder(
|
||||||
|
@ -19,6 +19,17 @@ InlineSpan richNode(item, context) {
|
|||||||
// 动态页面 richTextNodes 层级可能与主页动态层级不同
|
// 动态页面 richTextNodes 层级可能与主页动态层级不同
|
||||||
richTextNodes =
|
richTextNodes =
|
||||||
item.modules.moduleDynamic.major.opus.summary.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) {
|
if (richTextNodes == null || richTextNodes.isEmpty) {
|
||||||
return spacer;
|
return spacer;
|
||||||
|
@ -462,6 +462,9 @@ class ReplyItemRow extends StatelessWidget {
|
|||||||
|
|
||||||
InlineSpan buildContent(
|
InlineSpan buildContent(
|
||||||
BuildContext context, replyItem, replyReply, fReplyItem) {
|
BuildContext context, replyItem, replyReply, fReplyItem) {
|
||||||
|
final String routePath = Get.currentRoute;
|
||||||
|
bool isVideoPage = routePath.startsWith('/video');
|
||||||
|
|
||||||
// replyItem 当前回复内容
|
// replyItem 当前回复内容
|
||||||
// replyReply 查看二楼回复(回复详情)回调
|
// replyReply 查看二楼回复(回复详情)回调
|
||||||
// fReplyItem 父级回复内容,用作二楼回复(回复详情)展示
|
// fReplyItem 父级回复内容,用作二楼回复(回复详情)展示
|
||||||
@ -503,21 +506,25 @@ InlineSpan buildContent(
|
|||||||
.replaceAll('"', '"')
|
.replaceAll('"', '"')
|
||||||
.replaceAll(''', "'")
|
.replaceAll(''', "'")
|
||||||
.replaceAll(' ', ' ');
|
.replaceAll(' ', ' ');
|
||||||
// print("content.jumpUrl.keys:" + content.jumpUrl.keys.toString());
|
|
||||||
// 构建正则表达式
|
// 构建正则表达式
|
||||||
final List<String> specialTokens = [
|
final List<String> specialTokens = [
|
||||||
...content.emote.keys,
|
...content.emote.keys,
|
||||||
...content.topicsMeta?.keys?.map((e) => '#$e#') ?? [],
|
...content.topicsMeta?.keys?.map((e) => '#$e#') ?? [],
|
||||||
...content.atNameToMid.keys.map((e) => '@$e'),
|
...content.atNameToMid.keys.map((e) => '@$e'),
|
||||||
...content.jumpUrl.keys.map((e) =>
|
|
||||||
e.replaceAll('?', '\\?').replaceAll('+', '\\+').replaceAll('*', '\\*')),
|
|
||||||
];
|
];
|
||||||
|
List<dynamic> jumpUrlKeysList = content.jumpUrl.keys.map((e) {
|
||||||
|
return e.replaceAllMapped(
|
||||||
|
RegExp(r'[?+*]'), (match) => '\\${match.group(0)}');
|
||||||
|
}).toList();
|
||||||
|
|
||||||
String patternStr = specialTokens.map(RegExp.escape).join('|');
|
String patternStr = specialTokens.map(RegExp.escape).join('|');
|
||||||
if (patternStr.isNotEmpty) {
|
if (patternStr.isNotEmpty) {
|
||||||
patternStr += "|";
|
patternStr += "|";
|
||||||
}
|
}
|
||||||
patternStr += r'(\b(?:\d+[::])?[0-5]?[0-9][::][0-5]?[0-9]\b)';
|
patternStr += r'(\b(?:\d+[::])?[0-5]?[0-9][::][0-5]?[0-9]\b)';
|
||||||
|
if (jumpUrlKeysList.isNotEmpty) {
|
||||||
|
patternStr += '|${jumpUrlKeysList.join('|')}';
|
||||||
|
}
|
||||||
final RegExp pattern = RegExp(patternStr);
|
final RegExp pattern = RegExp(patternStr);
|
||||||
List<String> matchedStrs = [];
|
List<String> matchedStrs = [];
|
||||||
void addPlainTextSpan(str) {
|
void addPlainTextSpan(str) {
|
||||||
@ -571,27 +578,31 @@ InlineSpan buildContent(
|
|||||||
spanChilds.add(
|
spanChilds.add(
|
||||||
TextSpan(
|
TextSpan(
|
||||||
text: ' $matchStr ',
|
text: ' $matchStr ',
|
||||||
style: TextStyle(
|
style: isVideoPage
|
||||||
color: Theme.of(context).colorScheme.primary,
|
? TextStyle(
|
||||||
),
|
color: Theme.of(context).colorScheme.primary,
|
||||||
|
)
|
||||||
|
: null,
|
||||||
recognizer: TapGestureRecognizer()
|
recognizer: TapGestureRecognizer()
|
||||||
..onTap = () {
|
..onTap = () {
|
||||||
// 跳转到指定位置
|
// 跳转到指定位置
|
||||||
try {
|
if (isVideoPage) {
|
||||||
SmartDialog.showToast('跳转至:$matchStr');
|
try {
|
||||||
Get.find<VideoDetailController>(tag: Get.arguments['heroTag'])
|
SmartDialog.showToast('跳转至:$matchStr');
|
||||||
.plPlayerController
|
Get.find<VideoDetailController>(
|
||||||
.seekTo(
|
tag: Get.arguments['heroTag'])
|
||||||
Duration(seconds: Utils.duration(matchStr)),
|
.plPlayerController
|
||||||
);
|
.seekTo(
|
||||||
} catch (e) {
|
Duration(seconds: Utils.duration(matchStr)),
|
||||||
SmartDialog.showToast('跳转失败: $e');
|
);
|
||||||
|
} catch (e) {
|
||||||
|
SmartDialog.showToast('跳转失败: $e');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
print("matchStr=$matchStr");
|
|
||||||
String appUrlSchema = '';
|
String appUrlSchema = '';
|
||||||
final bool enableWordRe = setting.get(SettingBoxKey.enableWordRe,
|
final bool enableWordRe = setting.get(SettingBoxKey.enableWordRe,
|
||||||
defaultValue: false) as bool;
|
defaultValue: false) as bool;
|
||||||
|
Reference in New Issue
Block a user