diff --git a/lib/pages/dynamics/widgets/forward_panel.dart b/lib/pages/dynamics/widgets/forward_panel.dart index 3a8502b5..23379315 100644 --- a/lib/pages/dynamics/widgets/forward_panel.dart +++ b/lib/pages/dynamics/widgets/forward_panel.dart @@ -161,9 +161,40 @@ Widget forWard(item, context, source, callback, {floor = 1}) { return videoSeasonWidget(item, context, 'archive', floor: floor); // 文章 case 'DYNAMIC_TYPE_ARTICLE': - return item is ItemOrigModel - ? articlePanel(item, context, callback, floor: floor) - : const SizedBox.shrink(); + return switch (item) { + ItemOrigModel() => articlePanel(item, context, callback, floor: floor), + 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( // padding: // const EdgeInsets.only(left: 10, top: 12, right: 10, bottom: 10), diff --git a/lib/utils/utils.dart b/lib/utils/utils.dart index 5ceb8c75..d138ced2 100644 --- a/lib/utils/utils.dart +++ b/lib/utils/utils.dart @@ -235,23 +235,25 @@ class Utils { /// 专栏文章查看 case 'DYNAMIC_TYPE_ARTICLE': - String title = item.modules.moduleDynamic.major.opus.title; - String url = item.modules.moduleDynamic.major.opus.jumpUrl; - if (url.contains('opus') || url.contains('read')) { - RegExp digitRegExp = RegExp(r'\d+'); - Iterable matches = digitRegExp.allMatches(url); - String number = matches.first.group(0)!; - if (url.contains('read')) { - number = 'cv$number'; + String? url = item?.modules?.moduleDynamic?.major?.opus?.jumpUrl; + if (url != null) { + String? title = item?.modules?.moduleDynamic?.major?.opus?.title; + if (url.contains('opus') || url.contains('read')) { + RegExp digitRegExp = RegExp(r'\d+'); + Iterable matches = digitRegExp.allMatches(url); + String number = matches.first.group(0)!; + 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;