From 786f851a97e57eabb92106ee9c638850d94533c3 Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Fri, 27 Jun 2025 02:35:06 +0800 Subject: [PATCH] :bug: Fixes on post route --- lib/widgets/post/post_item.dart | 28 +++++++++++++++++-------- lib/widgets/post/post_item_creator.dart | 4 ++-- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/lib/widgets/post/post_item.dart b/lib/widgets/post/post_item.dart index 53f91ae..8f51861 100644 --- a/lib/widgets/post/post_item.dart +++ b/lib/widgets/post/post_item.dart @@ -71,7 +71,7 @@ class PostItem extends HookConsumerWidget { title: 'edit'.tr(), image: MenuImage.icon(Symbols.edit), callback: () { - context.push('/posts/item.id/edit').then((value) { + context.push('/posts/${item.id}/edit').then((value) { if (value != null) { onRefresh?.call(); } @@ -243,7 +243,8 @@ class PostItem extends HookConsumerWidget { : null, ), // Render tags and categories if they exist - if (item.tags.isNotEmpty || item.categories.isNotEmpty) + if (item.tags.isNotEmpty || + item.categories.isNotEmpty) Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -255,9 +256,13 @@ class PostItem extends HookConsumerWidget { child: Row( spacing: 4, children: [ - const Icon(Symbols.label, size: 13), - Text(tag.name ?? '#${tag.slug}') - .fontSize(13) + const Icon( + Symbols.label, + size: 13, + ), + Text( + tag.name ?? '#${tag.slug}', + ).fontSize(13), ], ), onTap: () {}, @@ -272,9 +277,14 @@ class PostItem extends HookConsumerWidget { child: Row( spacing: 4, children: [ - const Icon(Symbols.category, size: 13), - Text(category.name ?? '#${category.slug}') - .fontSize(13) + const Icon( + Symbols.category, + size: 13, + ), + Text( + category.name ?? + '#${category.slug}', + ).fontSize(13), ], ), onTap: () {}, @@ -324,7 +334,7 @@ class PostItem extends HookConsumerWidget { ), onTap: () { if (isOpenable) { - context.push('/posts/item.id'); + context.push('/posts/${item.id}'); } }, ), diff --git a/lib/widgets/post/post_item_creator.dart b/lib/widgets/post/post_item_creator.dart index 8295298..13a02f4 100644 --- a/lib/widgets/post/post_item_creator.dart +++ b/lib/widgets/post/post_item_creator.dart @@ -45,7 +45,7 @@ class PostItemCreator extends HookConsumerWidget { title: 'edit'.tr(), image: MenuImage.icon(Symbols.edit), callback: () { - context.push('/posts/item.id/edit').then((value) { + context.push('/posts/${item.id}/edit').then((value) { if (value != null) { onRefresh?.call(); } @@ -80,7 +80,7 @@ class PostItemCreator extends HookConsumerWidget { image: MenuImage.icon(Symbols.link), callback: () { // Copy post link to clipboard - context.push('/posts/item.id'); + context.push('/posts/${item.id}'); }, ), ],