💄 Adjust post detail screen
This commit is contained in:
@@ -466,11 +466,12 @@ class PostDetailScreen extends HookConsumerWidget {
|
|||||||
SliverToBoxAdapter(
|
SliverToBoxAdapter(
|
||||||
child: Center(
|
child: Center(
|
||||||
child: ConstrainedBox(
|
child: ConstrainedBox(
|
||||||
constraints: BoxConstraints(maxWidth: 600),
|
constraints: BoxConstraints(maxWidth: 800),
|
||||||
child: PostItem(
|
child: PostItem(
|
||||||
item: post!,
|
item: post!,
|
||||||
isFullPost: true,
|
isFullPost: true,
|
||||||
isEmbedReply: false,
|
isEmbedReply: false,
|
||||||
|
textScale: post.type == 1 ? 1.2 : 1.1,
|
||||||
onUpdate: (newItem) {
|
onUpdate: (newItem) {
|
||||||
// Update the local state with the new post data
|
// Update the local state with the new post data
|
||||||
ref
|
ref
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ class MarkdownTextContent extends HookConsumerWidget {
|
|||||||
|
|
||||||
final String content;
|
final String content;
|
||||||
final bool isAutoWarp;
|
final bool isAutoWarp;
|
||||||
final TextScaler? textScaler;
|
|
||||||
final TextStyle? textStyle;
|
final TextStyle? textStyle;
|
||||||
final TextStyle? linkStyle;
|
final TextStyle? linkStyle;
|
||||||
final EdgeInsets? linesMargin;
|
final EdgeInsets? linesMargin;
|
||||||
@@ -45,7 +44,6 @@ class MarkdownTextContent extends HookConsumerWidget {
|
|||||||
super.key,
|
super.key,
|
||||||
required this.content,
|
required this.content,
|
||||||
this.isAutoWarp = false,
|
this.isAutoWarp = false,
|
||||||
this.textScaler,
|
|
||||||
this.textStyle,
|
this.textStyle,
|
||||||
this.linkStyle,
|
this.linkStyle,
|
||||||
this.isSelectable = false,
|
this.isSelectable = false,
|
||||||
@@ -118,7 +116,7 @@ class MarkdownTextContent extends HookConsumerWidget {
|
|||||||
? PreConfig.darkConfig.copy(textStyle: textStyle)
|
? PreConfig.darkConfig.copy(textStyle: textStyle)
|
||||||
: PreConfig().copy(textStyle: textStyle),
|
: PreConfig().copy(textStyle: textStyle),
|
||||||
PConfig(
|
PConfig(
|
||||||
textStyle: textStyle ?? Theme.of(context).textTheme.bodyMedium!,
|
textStyle: (textStyle ?? Theme.of(context).textTheme.bodyMedium!),
|
||||||
),
|
),
|
||||||
HrConfig(height: 1, color: Theme.of(context).dividerColor),
|
HrConfig(height: 1, color: Theme.of(context).dividerColor),
|
||||||
PreConfig(
|
PreConfig(
|
||||||
|
|||||||
@@ -308,6 +308,7 @@ class PostItem extends HookConsumerWidget {
|
|||||||
final bool isTextSelectable;
|
final bool isTextSelectable;
|
||||||
final bool isTranslatable;
|
final bool isTranslatable;
|
||||||
final bool isCompact;
|
final bool isCompact;
|
||||||
|
final double? textScale;
|
||||||
final VoidCallback? onRefresh;
|
final VoidCallback? onRefresh;
|
||||||
final Function(SnPost)? onUpdate;
|
final Function(SnPost)? onUpdate;
|
||||||
final VoidCallback? onOpen;
|
final VoidCallback? onOpen;
|
||||||
@@ -322,6 +323,7 @@ class PostItem extends HookConsumerWidget {
|
|||||||
this.isTextSelectable = true,
|
this.isTextSelectable = true,
|
||||||
this.isTranslatable = true,
|
this.isTranslatable = true,
|
||||||
this.isCompact = false,
|
this.isCompact = false,
|
||||||
|
this.textScale,
|
||||||
this.onRefresh,
|
this.onRefresh,
|
||||||
this.onUpdate,
|
this.onUpdate,
|
||||||
this.onOpen,
|
this.onOpen,
|
||||||
@@ -422,6 +424,11 @@ class PostItem extends HookConsumerWidget {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
MarkdownTextContent(
|
MarkdownTextContent(
|
||||||
|
textStyle: TextStyle(
|
||||||
|
fontSize:
|
||||||
|
Theme.of(context).textTheme.bodyMedium!.fontSize! *
|
||||||
|
(textScale ?? 1),
|
||||||
|
),
|
||||||
content: translatedText.value!,
|
content: translatedText.value!,
|
||||||
isSelectable: isTextSelectable,
|
isSelectable: isTextSelectable,
|
||||||
attachments: item.attachments,
|
attachments: item.attachments,
|
||||||
@@ -557,6 +564,7 @@ class PostItem extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
PostBody(
|
PostBody(
|
||||||
item: item,
|
item: item,
|
||||||
|
textScale: textScale,
|
||||||
isFullPost: isFullPost,
|
isFullPost: isFullPost,
|
||||||
isTextSelectable: isTextSelectable,
|
isTextSelectable: isTextSelectable,
|
||||||
translationSection: translationSection,
|
translationSection: translationSection,
|
||||||
|
|||||||
@@ -870,6 +870,7 @@ class PostBody extends ConsumerWidget {
|
|||||||
final EdgeInsets renderingPadding;
|
final EdgeInsets renderingPadding;
|
||||||
final bool isRelativeTime;
|
final bool isRelativeTime;
|
||||||
final bool hideOverlay;
|
final bool hideOverlay;
|
||||||
|
final double? textScale;
|
||||||
|
|
||||||
const PostBody({
|
const PostBody({
|
||||||
super.key,
|
super.key,
|
||||||
@@ -881,6 +882,7 @@ class PostBody extends ConsumerWidget {
|
|||||||
this.renderingPadding = EdgeInsets.zero,
|
this.renderingPadding = EdgeInsets.zero,
|
||||||
this.isRelativeTime = true,
|
this.isRelativeTime = true,
|
||||||
this.hideOverlay = false,
|
this.hideOverlay = false,
|
||||||
|
this.textScale,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -1108,6 +1110,14 @@ class PostBody extends ConsumerWidget {
|
|||||||
],
|
],
|
||||||
).padding(bottom: 4),
|
).padding(bottom: 4),
|
||||||
MarkdownTextContent(
|
MarkdownTextContent(
|
||||||
|
linesMargin: item.type == 1 && isFullPost
|
||||||
|
? const EdgeInsets.symmetric(vertical: 8)
|
||||||
|
: const EdgeInsets.symmetric(vertical: 4),
|
||||||
|
textStyle: TextStyle(
|
||||||
|
fontSize:
|
||||||
|
Theme.of(context).textTheme.bodyMedium!.fontSize! *
|
||||||
|
(textScale ?? 1),
|
||||||
|
),
|
||||||
content: item.isTruncated
|
content: item.isTruncated
|
||||||
? '${_convertContentToMarkdown(item)}...'
|
? '${_convertContentToMarkdown(item)}...'
|
||||||
: _convertContentToMarkdown(item),
|
: _convertContentToMarkdown(item),
|
||||||
|
|||||||
Reference in New Issue
Block a user