Skip to content

Commit

Permalink
fix(html): Fix failed to parse detail base spoiler card
Browse files Browse the repository at this point in the history
  • Loading branch information
realth000 committed Sep 7, 2024
1 parent b3fdd39 commit 45a7fe4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- 帖子:修复用户资料中的腹黑显示为天然的问题。
- 帖子:修复滚动时偶现的白屏。
- 帖子:修复折叠/展开卡片上文字颜色错误的问题。
- 帖子:修复部分折叠/展开卡片解析失败的问题。
- 认证:修复登录页面刷新验证码时布局抖动的问题。
- 统计:修复积分统计中的积分值。
- 分区:修复开启帖子筛选条件时,显示没有置顶帖的问题。
Expand Down
9 changes: 6 additions & 3 deletions lib/utils/html/html_muncher.dart
Original file line number Diff line number Diff line change
Expand Up @@ -903,8 +903,11 @@ final class _Muncher with LoggerMixin {
List<InlineSpan>? _buildDetails(uh.Element element) {
final summary = element.children.elementAtOrNull(0);
state.elevation += 1;
final dataSpanList =
element.children.skip(1).map(_munch).whereType<InlineSpan>().toList();
final dataSpanList = element.children
.skip(1)
.map(_munch)
.whereType<List<InlineSpan>>()
.toList();
state.elevation -= 1;
if (summary == null || dataSpanList.isEmpty) {
return null;
Expand All @@ -919,7 +922,7 @@ final class _Muncher with LoggerMixin {
WidgetSpan(
child: SpoilerCard(
title: TextSpan(children: summarySpan),
content: TextSpan(children: dataSpanList.toList()),
content: TextSpan(children: dataSpanList.flattened.toList()),
elevation: state.elevation,
),
),
Expand Down

0 comments on commit 45a7fe4

Please sign in to comment.