Skip to content

Commit 916b517

Browse files
committed
refactor(details): remove country chip from details
- Removed headquarters chip - Fixed non-null assertion operator usage
1 parent f516788 commit 916b517

File tree

1 file changed

+7
-25
lines changed

1 file changed

+7
-25
lines changed

lib/headline-details/view/headline_details_page.dart

Lines changed: 7 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -400,11 +400,10 @@ class _HeadlineDetailsPageState extends State<HeadlineDetailsPage> {
400400
if (headline.source != null) {
401401
chips.add(
402402
GestureDetector(
403-
// Added GestureDetector
404403
onTap: () {
405404
context.push(
406405
Routes.sourceDetails,
407-
extra: EntityDetailsPageArguments(entity: headline.source),
406+
extra: EntityDetailsPageArguments(entity: headline.source!),
408407
);
409408
},
410409
child: Chip(
@@ -445,35 +444,15 @@ class _HeadlineDetailsPageState extends State<HeadlineDetailsPage> {
445444
);
446445
}
447446

448-
if (headline.source?.headquarters != null) {
449-
final country = headline.source!.headquarters!;
450-
chips.add(
451-
Chip(
452-
// Country chip is usually not tappable to a details page in this context
453-
avatar: CircleAvatar(
454-
radius: chipAvatarSize / 2,
455-
backgroundColor: Colors.transparent,
456-
backgroundImage: NetworkImage(country.flagUrl),
457-
onBackgroundImageError: (exception, stackTrace) {},
458-
),
459-
label: Text(country.name),
460-
labelStyle: chipLabelStyle,
461-
backgroundColor: chipBackgroundColor,
462-
padding: chipPadding,
463-
visualDensity: chipVisualDensity,
464-
materialTapTargetSize: chipMaterialTapTargetSize,
465-
),
466-
);
467-
}
447+
// Country chip for headline.source.headquarters removed.
468448

469449
if (headline.category != null) {
470450
chips.add(
471451
GestureDetector(
472-
// Added GestureDetector
473452
onTap: () {
474453
context.push(
475454
Routes.categoryDetails,
476-
extra: EntityDetailsPageArguments(entity: headline.category),
455+
extra: EntityDetailsPageArguments(entity: headline.category!),
477456
);
478457
},
479458
child: Chip(
@@ -551,6 +530,7 @@ class _HeadlineDetailsPageState extends State<HeadlineDetailsPage> {
551530
extra: similarHeadline,
552531
),
553532
);
533+
break;
554534
case HeadlineImageStyle.smallThumbnail:
555535
tile = HeadlineTileImageStart(
556536
headline: similarHeadline,
@@ -561,6 +541,7 @@ class _HeadlineDetailsPageState extends State<HeadlineDetailsPage> {
561541
extra: similarHeadline,
562542
),
563543
);
544+
break;
564545
case HeadlineImageStyle.largeThumbnail:
565546
tile = HeadlineTileImageTop(
566547
headline: similarHeadline,
@@ -571,12 +552,13 @@ class _HeadlineDetailsPageState extends State<HeadlineDetailsPage> {
571552
extra: similarHeadline,
572553
),
573554
);
555+
break;
574556
}
575557
return tile;
576558
},
577559
),
578560
);
579-
}, childCount: loadedState.similarHeadlines.length,),
561+
}, childCount: loadedState.similarHeadlines.length),
580562
),
581563
_ => const SliverToBoxAdapter(child: SizedBox.shrink()),
582564
};

0 commit comments

Comments
 (0)