💄 Optimize post actions
This commit is contained in:
		| @@ -59,12 +59,14 @@ class PostState extends StateNotifier<AsyncValue<SnPost?>> { | |||||||
|  |  | ||||||
| class PostActionButtons extends HookConsumerWidget { | class PostActionButtons extends HookConsumerWidget { | ||||||
|   final SnPost post; |   final SnPost post; | ||||||
|  |   final EdgeInsets renderingPadding; | ||||||
|   final VoidCallback? onRefresh; |   final VoidCallback? onRefresh; | ||||||
|   final Function(SnPost)? onUpdate; |   final Function(SnPost)? onUpdate; | ||||||
|  |  | ||||||
|   const PostActionButtons({ |   const PostActionButtons({ | ||||||
|     super.key, |     super.key, | ||||||
|     required this.post, |     required this.post, | ||||||
|  |     this.renderingPadding = EdgeInsets.zero, | ||||||
|     this.onRefresh, |     this.onRefresh, | ||||||
|     this.onUpdate, |     this.onUpdate, | ||||||
|   }); |   }); | ||||||
| @@ -151,7 +153,9 @@ class PostActionButtons extends HookConsumerWidget { | |||||||
|           children: |           children: | ||||||
|               editButtons |               editButtons | ||||||
|                   .map((e) => SizedBox(height: kButtonHeight, child: e)) |                   .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: |         children: | ||||||
|             shareButtons |             shareButtons | ||||||
|                 .map((e) => SizedBox(height: kButtonHeight, child: e)) |                 .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), |       margin: const EdgeInsets.only(bottom: 12), | ||||||
|       child: ListView( |       child: ListView( | ||||||
|         scrollDirection: Axis.horizontal, |         scrollDirection: Axis.horizontal, | ||||||
|         padding: const EdgeInsets.symmetric(horizontal: 8), |         padding: EdgeInsets.symmetric( | ||||||
|  |           horizontal: renderingPadding.horizontal + 4, | ||||||
|  |         ), | ||||||
|         children: children, |         children: children, | ||||||
|       ), |       ), | ||||||
|     ); |     ); | ||||||
| @@ -418,6 +426,9 @@ class PostDetailScreen extends HookConsumerWidget { | |||||||
|                           constraints: BoxConstraints(maxWidth: 600), |                           constraints: BoxConstraints(maxWidth: 600), | ||||||
|                           child: PostActionButtons( |                           child: PostActionButtons( | ||||||
|                             post: post, |                             post: post, | ||||||
|  |                             renderingPadding: const EdgeInsets.symmetric( | ||||||
|  |                               horizontal: 8, | ||||||
|  |                             ), | ||||||
|                             onRefresh: () { |                             onRefresh: () { | ||||||
|                               ref.invalidate(postProvider(id)); |                               ref.invalidate(postProvider(id)); | ||||||
|                               ref.invalidate(postRepliesNotifierProvider(id)); |                               ref.invalidate(postRepliesNotifierProvider(id)); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user