From 6d40d6bba3ea05a6acab4ef9ac227c43bd61af0b Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Tue, 17 Sep 2024 21:48:20 +0800 Subject: [PATCH] :lipstick: Optimize content --- lib/widgets/markdown_text_content.dart | 10 ++++++++++ lib/widgets/posts/post_item.dart | 2 ++ 2 files changed, 12 insertions(+) diff --git a/lib/widgets/markdown_text_content.dart b/lib/widgets/markdown_text_content.dart index c9cb928..eb706ef 100644 --- a/lib/widgets/markdown_text_content.dart +++ b/lib/widgets/markdown_text_content.dart @@ -14,12 +14,14 @@ class MarkdownTextContent extends StatelessWidget { final String content; final String parentId; final bool isSelectable; + final bool isLargeText; const MarkdownTextContent({ super.key, required this.content, required this.parentId, this.isSelectable = false, + this.isLargeText = false, }); Widget _buildContent(BuildContext context) { @@ -35,6 +37,14 @@ class MarkdownTextContent extends StatelessWidget { styleSheet: MarkdownStyleSheet.fromTheme( Theme.of(context), ).copyWith( + textScaleFactor: isLargeText ? 1.1 : 1, + blockquote: TextStyle( + color: Theme.of(context).colorScheme.onSurfaceVariant, + ), + blockquoteDecoration: BoxDecoration( + color: Theme.of(context).colorScheme.surfaceContainerHigh, + borderRadius: const BorderRadius.all(Radius.circular(4)), + ), horizontalRuleDecoration: BoxDecoration( border: Border( top: BorderSide( diff --git a/lib/widgets/posts/post_item.dart b/lib/widgets/posts/post_item.dart index 74bde13..18b510c 100644 --- a/lib/widgets/posts/post_item.dart +++ b/lib/widgets/posts/post_item.dart @@ -550,6 +550,8 @@ class _PostItemState extends State { parentId: 'p${item.id}-embed', content: item.body['content'], isSelectable: widget.isContentSelectable, + isLargeText: item.type == 'article' && + widget.isFullContent, ).paddingOnly(left: 12, right: 8), ), ),