From 354282930cdb5f85595e135eb69dc80d7c332bd6 Mon Sep 17 00:00:00 2001 From: Starfallen <36763490+Starfallan@users.noreply.github.com> Date: Thu, 23 Apr 2026 21:17:43 +0800 Subject: [PATCH] fix(article): fix Opus article body font size too small (#1897) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit New Opus format uses font_level string instead of numeric font_size, causing font size to fall back to Flutter theme default (14px) instead of the expected 16px. Added Word.effectiveFontSize: small→13px, others→16px (consistent with legacy HTML article format). --- lib/models/dynamics/article_content_model.dart | 7 +++++++ lib/pages/article/widgets/opus_content.dart | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/models/dynamics/article_content_model.dart b/lib/models/dynamics/article_content_model.dart index 69a5f4ff3..9911fe028 100644 --- a/lib/models/dynamics/article_content_model.dart +++ b/lib/models/dynamics/article_content_model.dart @@ -134,6 +134,13 @@ class Word { ); fontLevel = json['font_level']; } + + // font_level 映射处理: + // "small" → 13px + // "regular" → 16px(与旧版 HTML 专栏基准一致) + // 其余/null → 同 regular + double get effectiveFontSize => + fontSize ?? (fontLevel == 'small' ? 13.0 : 16.0); } class Style { diff --git a/lib/pages/article/widgets/opus_content.dart b/lib/pages/article/widgets/opus_content.dart index 3426070c6..bb322ee8e 100644 --- a/lib/pages/article/widgets/opus_content.dart +++ b/lib/pages/article/widgets/opus_content.dart @@ -151,7 +151,7 @@ class OpusContent extends StatelessWidget { style: _getStyle( word?.style, color ?? defaultColor, - word?.fontSize, + word?.effectiveFontSize, ), ); }