Skip to content

Commit 36b82e2

Browse files
committed
feat(headlines): Improve headline item UI
- Display headline in a card - Added image and source info - Improved visual appeal
1 parent 3ad8f6e commit 36b82e2

File tree

3 files changed

+38
-15
lines changed

3 files changed

+38
-15
lines changed

lib/headlines-feed/widgets/headline_item_widget.dart

Lines changed: 35 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,45 @@ class HeadlineItemWidget extends StatelessWidget {
1414
Widget build(BuildContext context) {
1515
return Padding(
1616
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 16),
17-
child: Column(
18-
crossAxisAlignment: CrossAxisAlignment.start,
19-
children: [
20-
Text(
17+
child: Card(
18+
child: ListTile(
19+
leading: Image.network(
20+
headline.imageUrl ??
21+
'https://via.placeholder.com/50x50', // Placeholder image
22+
width: 50,
23+
height: 50,
24+
fit: BoxFit.cover,
25+
errorBuilder: (context, error, stackTrace) =>
26+
const Icon(Icons.error),
27+
),
28+
title: Text(
2129
headline.title,
2230
style: Theme.of(context).textTheme.titleMedium,
31+
maxLines: 2,
32+
overflow: TextOverflow.ellipsis,
2333
),
24-
if (headline.description != null)
25-
Padding(
26-
padding: const EdgeInsets.only(top: 4),
27-
child: Text(
28-
headline.description!,
29-
style: Theme.of(context).textTheme.bodySmall,
30-
),
34+
subtitle: Padding(
35+
padding: const EdgeInsets.only(top: 8),
36+
child: Row(
37+
children: [
38+
Icon(Icons.source,
39+
color: Theme.of(context)
40+
.iconTheme
41+
.color,), // Placeholder for source icon
42+
const SizedBox(width: 16),
43+
Icon(Icons.category,
44+
color: Theme.of(context)
45+
.iconTheme
46+
.color,), // Placeholder for category icon
47+
const SizedBox(width: 16),
48+
Icon(Icons.location_on,
49+
color: Theme.of(context)
50+
.iconTheme
51+
.color,), // Placeholder for country icon
52+
],
3153
),
32-
],
54+
),
55+
),
3356
),
3457
);
3558
}

lib/shared/widgets/failure_state_widget.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ class FailureStateWidget extends StatelessWidget {
55
/// Creates a [FailureStateWidget].
66
///
77
/// The [message] is the error message to display.
8-
///
9-
/// The [onRetry] is an optional callback to be called
8+
///
9+
/// The [onRetry] is an optional callback to be called
1010
/// when the retry button is pressed.
1111
const FailureStateWidget({
1212
required this.message,

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: ht_main
22
description: main headlines toolkit mobile app.
3-
version: 0.8.5
3+
version: 0.9.5
44
publish_to: none
55
repository: https://github.com/headlines-toolkit/ht-main
66
environment:

0 commit comments

Comments
 (0)