💄 New media post layout

This commit is contained in:
2026-01-07 23:30:48 +08:00
parent 38fc4e969f
commit 9cba568e47
6 changed files with 169 additions and 54 deletions

View File

@@ -67,6 +67,7 @@ class PostActionableItem extends HookConsumerWidget {
final bool isEmbedReply;
final bool isEmbedOpenable;
final bool isCompact;
final bool hideAttachments;
final double? borderRadius;
final VoidCallback? onRefresh;
final Function(SnPost)? onUpdate;
@@ -80,6 +81,7 @@ class PostActionableItem extends HookConsumerWidget {
this.isEmbedReply = true,
this.isEmbedOpenable = false,
this.isCompact = false,
this.hideAttachments = false,
this.borderRadius,
this.onRefresh,
this.onUpdate,
@@ -110,6 +112,7 @@ class PostActionableItem extends HookConsumerWidget {
isEmbedOpenable: isEmbedOpenable,
isTextSelectable: false,
isCompact: isCompact,
hideAttachments: hideAttachments,
onRefresh: onRefresh,
onUpdate: onUpdate,
onOpen: onOpen,
@@ -308,6 +311,7 @@ class PostItem extends HookConsumerWidget {
final bool isTextSelectable;
final bool isTranslatable;
final bool isCompact;
final bool hideAttachments;
final double? textScale;
final VoidCallback? onRefresh;
final Function(SnPost)? onUpdate;
@@ -323,6 +327,7 @@ class PostItem extends HookConsumerWidget {
this.isTextSelectable = true,
this.isTranslatable = true,
this.isCompact = false,
this.hideAttachments = false,
this.textScale,
this.onRefresh,
this.onUpdate,
@@ -569,6 +574,7 @@ class PostItem extends HookConsumerWidget {
isTextSelectable: isTextSelectable,
translationSection: translationSection,
renderingPadding: renderingPadding,
hideAttachments: hideAttachments,
),
if (item.embedView != null)
EmbedViewRenderer(

View File

@@ -69,7 +69,7 @@ class SliverPostList extends HookConsumerWidget {
isSliver: true,
footerSkeletonChild: Padding(
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
child: const PostItemSkeleton(),
child: PostItemSkeleton(maxWidth: maxWidth ?? double.infinity),
),
itemBuilder: (context, index, post) {
if (maxWidth != null) {

View File

@@ -50,7 +50,7 @@ class PostRepliesList extends HookConsumerWidget {
final skeletonItem = Padding(
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
child: const PostItemSkeleton(),
child: PostItemSkeleton(maxWidth: maxWidth ?? double.infinity),
);
return PaginationList(

View File

@@ -870,6 +870,7 @@ class PostBody extends ConsumerWidget {
final EdgeInsets renderingPadding;
final bool isRelativeTime;
final bool hideOverlay;
final bool hideAttachments;
final double? textScale;
const PostBody({
@@ -882,6 +883,7 @@ class PostBody extends ConsumerWidget {
this.renderingPadding = EdgeInsets.zero,
this.isRelativeTime = true,
this.hideOverlay = false,
this.hideAttachments = false,
this.textScale,
});
@@ -1140,7 +1142,7 @@ class PostBody extends ConsumerWidget {
right: renderingPadding.horizontal,
),
),
if (item.attachments.isNotEmpty && item.type != 1)
if (item.attachments.isNotEmpty && item.type != 1 && !hideAttachments)
CloudFileList(
files: item.attachments,
isColumn: !isInteractive,