Skip to content

Commit 3d146af

Browse files
committed
feat(headline-details): add creation date chip and remove duplicate padding
- Add a date chip to the metadata section - Remove duplicate SliverPadding for date display - Adjust chip appearance (border radius, spacing) - Update date format to 'yyyy-MM-dd' - Improve code readability by specifying function parameter types
1 parent b54c43c commit 3d146af

File tree

1 file changed

+9
-15
lines changed

1 file changed

+9
-15
lines changed

lib/headline-details/view/headline_details_page.dart

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -341,17 +341,6 @@ class _HeadlineDetailsPageState extends State<HeadlineDetailsPage> {
341341
),
342342
),
343343
),
344-
SliverPadding(
345-
padding: horizontalPadding.copyWith(top: AppSpacing.md),
346-
sliver: SliverToBoxAdapter(
347-
child: Text(
348-
DateFormat('yyyy/MM/dd').format(headline.createdAt),
349-
style: textTheme.bodyMedium?.copyWith(
350-
color: colorScheme.onSurfaceVariant.withOpacity(0.7),
351-
),
352-
),
353-
),
354-
),
355344
SliverPadding(
356345
padding: EdgeInsets.only(
357346
top: AppSpacing.md,
@@ -408,7 +397,8 @@ class _HeadlineDetailsPageState extends State<HeadlineDetailsPage> {
408397
separatorBuilder: (context, index) =>
409398
const SizedBox(width: AppSpacing.sm),
410399
itemBuilder: (context, index) => chips[index],
411-
clipBehavior: Clip.none,
400+
// Apply horizontal padding directly to the ListView
401+
// to ensure consistent spacing at both ends. This is now handled by the parent SliverPadding.
412402
);
413403

414404
// Determine if the fade should be shown based on scroll position.
@@ -630,11 +620,11 @@ class _HeadlineDetailsPageState extends State<HeadlineDetailsPage> {
630620
List<Widget> _buildMetadataChips(
631621
BuildContext context,
632622
Headline headline,
633-
void Function(ContentType type, String id) onEntityChipTap,
623+
void Function(ContentType, String) onEntityChipTap,
634624
) {
635625
final theme = Theme.of(context);
636626

637-
Widget buildChip({required String label, required VoidCallback onPressed}) {
627+
Widget buildChip({required String label, VoidCallback? onPressed}) {
638628
return ActionChip(
639629
label: Text(label),
640630
// Use default theme styles for a cleaner look.
@@ -646,13 +636,17 @@ class _HeadlineDetailsPageState extends State<HeadlineDetailsPage> {
646636
vertical: AppSpacing.xs,
647637
),
648638
shape: RoundedRectangleBorder(
649-
borderRadius: BorderRadius.circular(AppSpacing.lg),
639+
borderRadius: BorderRadius.circular(AppSpacing.md),
650640
side: BorderSide.none,
651641
),
652642
);
653643
}
654644

655645
return [
646+
buildChip(
647+
label: DateFormat('yyyy-MM-dd').format(headline.createdAt),
648+
onPressed: null, // This makes the chip non-interactive.
649+
),
656650
buildChip(
657651
label: headline.source.name,
658652
onPressed: () =>

0 commit comments

Comments
 (0)