💄 Optimize content

This commit is contained in:
LittleSheep 2024-09-17 21:48:20 +08:00
parent 77075c8dab
commit 6d40d6bba3
2 changed files with 12 additions and 0 deletions

View File

@ -14,12 +14,14 @@ class MarkdownTextContent extends StatelessWidget {
final String content; final String content;
final String parentId; final String parentId;
final bool isSelectable; final bool isSelectable;
final bool isLargeText;
const MarkdownTextContent({ const MarkdownTextContent({
super.key, super.key,
required this.content, required this.content,
required this.parentId, required this.parentId,
this.isSelectable = false, this.isSelectable = false,
this.isLargeText = false,
}); });
Widget _buildContent(BuildContext context) { Widget _buildContent(BuildContext context) {
@ -35,6 +37,14 @@ class MarkdownTextContent extends StatelessWidget {
styleSheet: MarkdownStyleSheet.fromTheme( styleSheet: MarkdownStyleSheet.fromTheme(
Theme.of(context), Theme.of(context),
).copyWith( ).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( horizontalRuleDecoration: BoxDecoration(
border: Border( border: Border(
top: BorderSide( top: BorderSide(

View File

@ -550,6 +550,8 @@ class _PostItemState extends State<PostItem> {
parentId: 'p${item.id}-embed', parentId: 'p${item.id}-embed',
content: item.body['content'], content: item.body['content'],
isSelectable: widget.isContentSelectable, isSelectable: widget.isContentSelectable,
isLargeText: item.type == 'article' &&
widget.isFullContent,
).paddingOnly(left: 12, right: 8), ).paddingOnly(left: 12, right: 8),
), ),
), ),