Skip to content

Commit dd8c786

Browse files
committed
refactor(details): reorder chips on details page
- Date chip is now the first chip - Source chip is now the second chip - Category chip is now the third chip
1 parent 7000630 commit dd8c786

File tree

1 file changed

+24
-21
lines changed

1 file changed

+24
-21
lines changed

lib/headline-details/view/headline_details_page.dart

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,29 @@ class _HeadlineDetailsPageState extends State<HeadlineDetailsPage> {
397397

398398
final chips = <Widget>[];
399399

400+
// 1. Add Date Chip First
401+
if (headline.publishedAt != null) {
402+
final formattedDate = DateFormat(
403+
'MMM d, yyyy',
404+
).format(headline.publishedAt!);
405+
chips.add(
406+
Chip(
407+
avatar: Icon(
408+
Icons.date_range,
409+
size: chipAvatarSize,
410+
color: chipAvatarColor,
411+
),
412+
label: Text(formattedDate),
413+
labelStyle: chipLabelStyle,
414+
backgroundColor: chipBackgroundColor,
415+
padding: chipPadding,
416+
visualDensity: chipVisualDensity,
417+
materialTapTargetSize: chipMaterialTapTargetSize,
418+
),
419+
);
420+
}
421+
422+
// 2. Add Source Chip Second
400423
if (headline.source != null) {
401424
chips.add(
402425
GestureDetector(
@@ -423,29 +446,9 @@ class _HeadlineDetailsPageState extends State<HeadlineDetailsPage> {
423446
);
424447
}
425448

426-
if (headline.publishedAt != null) {
427-
final formattedDate = DateFormat(
428-
'MMM d, yyyy',
429-
).format(headline.publishedAt!);
430-
chips.add(
431-
Chip(
432-
avatar: Icon(
433-
Icons.date_range,
434-
size: chipAvatarSize,
435-
color: chipAvatarColor,
436-
),
437-
label: Text(formattedDate),
438-
labelStyle: chipLabelStyle,
439-
backgroundColor: chipBackgroundColor,
440-
padding: chipPadding,
441-
visualDensity: chipVisualDensity,
442-
materialTapTargetSize: chipMaterialTapTargetSize,
443-
),
444-
);
445-
}
446-
447449
// Country chip for headline.source.headquarters removed.
448450

451+
// 3. Add Category Chip Third
449452
if (headline.category != null) {
450453
chips.add(
451454
GestureDetector(

0 commit comments

Comments
 (0)