@@ -246,15 +246,16 @@ class _HeadlineDetailsView extends StatelessWidget {
246
246
247
247
// Source Chip
248
248
if (headline.source != null ) {
249
- // TODO(fulleni): Replace Icon with Image.network when source. logoUrl is available
249
+ // Source model doesn't have a logoUrl, using a generic icon.
250
250
chips.add (
251
251
Chip (
252
252
avatar: Icon (
253
- Icons .source,
253
+ Icons .source, // Generic source icon
254
254
size: chipAvatarSize,
255
255
color: chipAvatarColor,
256
256
),
257
- label: Text (headline.source! ),
257
+ // Use source.name
258
+ label: Text (headline.source! .name),
258
259
labelStyle: chipLabelStyle,
259
260
backgroundColor: chipBackgroundColor,
260
261
padding: chipPadding,
@@ -288,15 +289,19 @@ class _HeadlineDetailsView extends StatelessWidget {
288
289
289
290
// Country Chip
290
291
if (headline.eventCountry != null ) {
291
- // TODO(fulleni): Replace Icon with Image.network when country.flagUrl is available
292
+ // Use country.flagUrl for the avatar
292
293
chips.add (
293
294
Chip (
294
- avatar: Icon (
295
- Icons .location_on,
296
- size: chipAvatarSize,
297
- color: chipAvatarColor,
295
+ avatar: CircleAvatar ( // Use CircleAvatar for better image display
296
+ radius: chipAvatarSize / 2 , // Adjust radius as needed
297
+ backgroundColor: Colors .transparent, // Avoid background color clash
298
+ backgroundImage: NetworkImage (headline.eventCountry! .flagUrl),
299
+ onBackgroundImageError: (exception, stackTrace) {
300
+ // Optional: Handle image loading errors, e.g., show placeholder
301
+ },
298
302
),
299
- label: Text (headline.eventCountry! ),
303
+ // Use eventCountry.name
304
+ label: Text (headline.eventCountry! .name),
300
305
labelStyle: chipLabelStyle,
301
306
backgroundColor: chipBackgroundColor,
302
307
padding: chipPadding,
@@ -306,20 +311,19 @@ class _HeadlineDetailsView extends StatelessWidget {
306
311
);
307
312
}
308
313
309
- // Category Chips (No avatar for individual categories)
310
- if (headline.categories != null ) {
311
- for (final category in headline.categories! ) {
312
- chips.add (
313
- Chip (
314
- label: Text (category),
315
- labelStyle: chipLabelStyle,
316
- backgroundColor: chipBackgroundColor,
317
- padding: chipPadding,
318
- visualDensity: chipVisualDensity,
319
- materialTapTargetSize: chipMaterialTapTargetSize,
320
- ),
321
- );
322
- }
314
+ // Category Chip (No avatar for individual category)
315
+ if (headline.category != null ) {
316
+ chips.add (
317
+ Chip (
318
+ // Use category.name
319
+ label: Text (headline.category! .name),
320
+ labelStyle: chipLabelStyle,
321
+ backgroundColor: chipBackgroundColor,
322
+ padding: chipPadding,
323
+ visualDensity: chipVisualDensity,
324
+ materialTapTargetSize: chipMaterialTapTargetSize,
325
+ ),
326
+ );
323
327
}
324
328
325
329
return chips;
0 commit comments