|
3 | 3 |
|
4 | 4 | import 'package:flutter/material.dart';
|
5 | 5 | import 'package:flutter_bloc/flutter_bloc.dart';
|
6 |
| -import 'package:ht_headlines_client/ht_headlines_client.dart'; |
7 | 6 | import 'package:ht_main/headline-details/bloc/headline_details_bloc.dart';
|
8 | 7 | import 'package:ht_main/l10n/l10n.dart';
|
9 | 8 | import 'package:ht_main/shared/shared.dart';
|
| 9 | +import 'package:ht_shared/ht_shared.dart' |
| 10 | + show Headline; // Import Headline model |
10 | 11 | import 'package:intl/intl.dart';
|
11 | 12 | import 'package:url_launcher/url_launcher_string.dart';
|
12 | 13 |
|
@@ -265,22 +266,20 @@ class HeadlineDetailsPage extends StatelessWidget {
|
265 | 266 | );
|
266 | 267 | }
|
267 | 268 |
|
268 |
| - // Country Chip |
269 |
| - if (headline.eventCountry != null) { |
270 |
| - // Use country.flagUrl for the avatar |
| 269 | + // Country Chip (from Source Headquarters) |
| 270 | + if (headline.source?.headquarters != null) { |
| 271 | + final country = headline.source!.headquarters!; |
271 | 272 | chips.add(
|
272 | 273 | Chip(
|
273 | 274 | avatar: CircleAvatar(
|
274 |
| - // Use CircleAvatar for better image display |
275 |
| - radius: chipAvatarSize / 2, // Adjust radius as needed |
276 |
| - backgroundColor: Colors.transparent, // Avoid background color clash |
277 |
| - backgroundImage: NetworkImage(headline.eventCountry!.flagUrl), |
| 275 | + radius: chipAvatarSize / 2, |
| 276 | + backgroundColor: Colors.transparent, |
| 277 | + backgroundImage: NetworkImage(country.flagUrl), |
278 | 278 | onBackgroundImageError: (exception, stackTrace) {
|
279 | 279 | // Optional: Handle image loading errors, e.g., show placeholder
|
280 | 280 | },
|
281 | 281 | ),
|
282 |
| - // Use eventCountry.name |
283 |
| - label: Text(headline.eventCountry!.name), |
| 282 | + label: Text(country.name), |
284 | 283 | labelStyle: chipLabelStyle,
|
285 | 284 | backgroundColor: chipBackgroundColor,
|
286 | 285 | padding: chipPadding,
|
|
0 commit comments