mod: dyn article: show block type

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-02-09 22:47:25 +08:00
parent 7744217d17
commit 8f5c2bf3ba
2 changed files with 52 additions and 19 deletions

View File

@@ -161,9 +161,40 @@ Widget forWard(item, context, source, callback, {floor = 1}) {
return videoSeasonWidget(item, context, 'archive', floor: floor); return videoSeasonWidget(item, context, 'archive', floor: floor);
// 文章 // 文章
case 'DYNAMIC_TYPE_ARTICLE': case 'DYNAMIC_TYPE_ARTICLE':
return item is ItemOrigModel return switch (item) {
? articlePanel(item, context, callback, floor: floor) ItemOrigModel() => articlePanel(item, context, callback, floor: floor),
: const SizedBox.shrink(); DynamicItemModel() => item.modules?.moduleDynamic?.major?.blocked !=
null
? Padding(
padding: const EdgeInsets.symmetric(horizontal: 12),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
if (item.modules?.moduleDynamic?.major?.blocked?['title'] !=
null)
Text(
'${item.modules?.moduleDynamic?.major?.blocked!['title']}',
style: TextStyle(
color: Theme.of(context).colorScheme.secondary,
),
),
if (item.modules?.moduleDynamic?.major
?.blocked?['hint_message'] !=
null)
Text(
'${item.modules?.moduleDynamic?.major?.blocked!['hint_message']}',
style: TextStyle(
fontSize: 12,
color: Theme.of(context).colorScheme.outline,
),
)
],
),
)
: const SizedBox.shrink(),
_ => const SizedBox.shrink(),
};
// return Container( // return Container(
// padding: // padding:
// const EdgeInsets.only(left: 10, top: 12, right: 10, bottom: 10), // const EdgeInsets.only(left: 10, top: 12, right: 10, bottom: 10),

View File

@@ -235,23 +235,25 @@ class Utils {
/// 专栏文章查看 /// 专栏文章查看
case 'DYNAMIC_TYPE_ARTICLE': case 'DYNAMIC_TYPE_ARTICLE':
String title = item.modules.moduleDynamic.major.opus.title; String? url = item?.modules?.moduleDynamic?.major?.opus?.jumpUrl;
String url = item.modules.moduleDynamic.major.opus.jumpUrl; if (url != null) {
if (url.contains('opus') || url.contains('read')) { String? title = item?.modules?.moduleDynamic?.major?.opus?.title;
RegExp digitRegExp = RegExp(r'\d+'); if (url.contains('opus') || url.contains('read')) {
Iterable<Match> matches = digitRegExp.allMatches(url); RegExp digitRegExp = RegExp(r'\d+');
String number = matches.first.group(0)!; Iterable<Match> matches = digitRegExp.allMatches(url);
if (url.contains('read')) { String number = matches.first.group(0)!;
number = 'cv$number'; if (url.contains('read')) {
number = 'cv$number';
}
Utils.toDupNamed('/htmlRender', parameters: {
'url': url.startsWith('//') ? url.split('//').last : url,
'title': title ?? '',
'id': number,
'dynamicType': url.split('//').last.split('/')[1]
});
} else {
Utils.handleWebview('https:$url');
} }
Utils.toDupNamed('/htmlRender', parameters: {
'url': url.startsWith('//') ? url.split('//').last : url,
'title': title,
'id': number,
'dynamicType': url.split('//').last.split('/')[1]
});
} else {
Utils.handleWebview('https:$url');
} }
break; break;