🐛 Fixes on post route

This commit is contained in:
LittleSheep 2025-06-27 02:35:06 +08:00
parent 4deff5a920
commit 786f851a97
2 changed files with 21 additions and 11 deletions

View File

@ -71,7 +71,7 @@ class PostItem extends HookConsumerWidget {
title: 'edit'.tr(), title: 'edit'.tr(),
image: MenuImage.icon(Symbols.edit), image: MenuImage.icon(Symbols.edit),
callback: () { callback: () {
context.push('/posts/item.id/edit').then((value) { context.push('/posts/${item.id}/edit').then((value) {
if (value != null) { if (value != null) {
onRefresh?.call(); onRefresh?.call();
} }
@ -243,7 +243,8 @@ class PostItem extends HookConsumerWidget {
: null, : null,
), ),
// Render tags and categories if they exist // Render tags and categories if they exist
if (item.tags.isNotEmpty || item.categories.isNotEmpty) if (item.tags.isNotEmpty ||
item.categories.isNotEmpty)
Column( Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
@ -255,9 +256,13 @@ class PostItem extends HookConsumerWidget {
child: Row( child: Row(
spacing: 4, spacing: 4,
children: [ children: [
const Icon(Symbols.label, size: 13), const Icon(
Text(tag.name ?? '#${tag.slug}') Symbols.label,
.fontSize(13) size: 13,
),
Text(
tag.name ?? '#${tag.slug}',
).fontSize(13),
], ],
), ),
onTap: () {}, onTap: () {},
@ -272,9 +277,14 @@ class PostItem extends HookConsumerWidget {
child: Row( child: Row(
spacing: 4, spacing: 4,
children: [ children: [
const Icon(Symbols.category, size: 13), const Icon(
Text(category.name ?? '#${category.slug}') Symbols.category,
.fontSize(13) size: 13,
),
Text(
category.name ??
'#${category.slug}',
).fontSize(13),
], ],
), ),
onTap: () {}, onTap: () {},
@ -324,7 +334,7 @@ class PostItem extends HookConsumerWidget {
), ),
onTap: () { onTap: () {
if (isOpenable) { if (isOpenable) {
context.push('/posts/item.id'); context.push('/posts/${item.id}');
} }
}, },
), ),

View File

@ -45,7 +45,7 @@ class PostItemCreator extends HookConsumerWidget {
title: 'edit'.tr(), title: 'edit'.tr(),
image: MenuImage.icon(Symbols.edit), image: MenuImage.icon(Symbols.edit),
callback: () { callback: () {
context.push('/posts/item.id/edit').then((value) { context.push('/posts/${item.id}/edit').then((value) {
if (value != null) { if (value != null) {
onRefresh?.call(); onRefresh?.call();
} }
@ -80,7 +80,7 @@ class PostItemCreator extends HookConsumerWidget {
image: MenuImage.icon(Symbols.link), image: MenuImage.icon(Symbols.link),
callback: () { callback: () {
// Copy post link to clipboard // Copy post link to clipboard
context.push('/posts/item.id'); context.push('/posts/${item.id}');
}, },
), ),
], ],