💄 Optimized post category and tag
This commit is contained in:
@@ -571,32 +571,45 @@ class PostItem extends HookConsumerWidget {
|
|||||||
vertical: 4,
|
vertical: 4,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
if (item.tags.isNotEmpty)
|
||||||
|
Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
spacing: 2,
|
||||||
|
children: [
|
||||||
if (item.tags.isNotEmpty)
|
if (item.tags.isNotEmpty)
|
||||||
Wrap(
|
Wrap(
|
||||||
|
runAlignment: WrapAlignment.center,
|
||||||
spacing: 8,
|
spacing: 8,
|
||||||
children: [
|
children: [
|
||||||
for (final tag in item.tags)
|
const Icon(Symbols.label, size: 16).padding(top: 2),
|
||||||
|
for (final tag
|
||||||
|
in isFullPost ? item.tags : item.tags.take(3))
|
||||||
InkWell(
|
InkWell(
|
||||||
child: Row(
|
child: Text('#${tag.name ?? tag.slug}'),
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
spacing: 4,
|
|
||||||
children: [
|
|
||||||
const Icon(Symbols.label, size: 16),
|
|
||||||
Text(tag.name ?? tag.slug),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
onTap: () {},
|
onTap: () {},
|
||||||
),
|
),
|
||||||
for (final category in item.categories)
|
if (!isFullPost && item.tags.length > 3)
|
||||||
InkWell(
|
Text('+${item.tags.length - 3}').opacity(0.6),
|
||||||
child: Row(
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
spacing: 4,
|
|
||||||
children: [
|
|
||||||
const Icon(Symbols.category, size: 16),
|
|
||||||
Text(category.categoryDisplayTitle),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
if (item.categories.isNotEmpty)
|
||||||
|
Wrap(
|
||||||
|
runAlignment: WrapAlignment.center,
|
||||||
|
spacing: 8,
|
||||||
|
children: [
|
||||||
|
const Icon(Symbols.category, size: 16).padding(top: 2),
|
||||||
|
for (final category
|
||||||
|
in isFullPost
|
||||||
|
? item.categories
|
||||||
|
: item.categories.take(2))
|
||||||
|
InkWell(
|
||||||
|
child: Text(category.categoryDisplayTitle),
|
||||||
|
onTap: () {},
|
||||||
|
),
|
||||||
|
if (!isFullPost && item.categories.length > 2)
|
||||||
|
Text('+${item.categories.length - 2}').opacity(0.6),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
).padding(horizontal: renderingPadding.horizontal + 4, top: 4),
|
).padding(horizontal: renderingPadding.horizontal + 4, top: 4),
|
||||||
|
Reference in New Issue
Block a user