From 2617a64acfd7f4ed36f9e8081df9f17b5bd731b9 Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Sun, 7 Sep 2025 13:11:18 +0800 Subject: [PATCH] :lipstick: Optimize post actions --- lib/screens/posts/post_detail.dart | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/lib/screens/posts/post_detail.dart b/lib/screens/posts/post_detail.dart index 6e60cb66..60f0be51 100644 --- a/lib/screens/posts/post_detail.dart +++ b/lib/screens/posts/post_detail.dart @@ -59,12 +59,14 @@ class PostState extends StateNotifier> { class PostActionButtons extends HookConsumerWidget { final SnPost post; + final EdgeInsets renderingPadding; final VoidCallback? onRefresh; final Function(SnPost)? onUpdate; const PostActionButtons({ super.key, required this.post, + this.renderingPadding = EdgeInsets.zero, this.onRefresh, this.onUpdate, }); @@ -151,7 +153,9 @@ class PostActionButtons extends HookConsumerWidget { children: editButtons .map((e) => SizedBox(height: kButtonHeight, child: e)) - .toList(), + .expand((widget) => [widget, const VerticalDivider(width: 1)]) + .toList() + ..removeLast(), ), ); @@ -316,7 +320,9 @@ class PostActionButtons extends HookConsumerWidget { children: shareButtons .map((e) => SizedBox(height: kButtonHeight, child: e)) - .toList(), + .expand((widget) => [widget, const VerticalDivider(width: 1)]) + .toList() + ..removeLast(), ), ); @@ -359,7 +365,9 @@ class PostActionButtons extends HookConsumerWidget { margin: const EdgeInsets.only(bottom: 12), child: ListView( scrollDirection: Axis.horizontal, - padding: const EdgeInsets.symmetric(horizontal: 8), + padding: EdgeInsets.symmetric( + horizontal: renderingPadding.horizontal + 4, + ), children: children, ), ); @@ -418,6 +426,9 @@ class PostDetailScreen extends HookConsumerWidget { constraints: BoxConstraints(maxWidth: 600), child: PostActionButtons( post: post, + renderingPadding: const EdgeInsets.symmetric( + horizontal: 8, + ), onRefresh: () { ref.invalidate(postProvider(id)); ref.invalidate(postRepliesNotifierProvider(id));