Skip to content

Commit d13cf5d

Browse files
committed
feat: create source item widget
- Display source name and description - Handle tap event with snackbar
1 parent fab1673 commit d13cf5d

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import 'package:flutter/material.dart';
2+
import 'package:ht_shared/ht_shared.dart'; // Import Source model
3+
4+
/// A simple widget to display a Source search result.
5+
class SourceItemWidget extends StatelessWidget {
6+
const SourceItemWidget({required this.source, super.key});
7+
8+
final Source source;
9+
10+
@override
11+
Widget build(BuildContext context) {
12+
return ListTile(
13+
title: Text(source.name),
14+
subtitle: source.description != null
15+
? Text(
16+
source.description!,
17+
maxLines: 2,
18+
overflow: TextOverflow.ellipsis,
19+
)
20+
: null,
21+
// TODO(you): Implement onTap navigation if needed for sources
22+
onTap: () {
23+
// Example: Navigate to a page showing headlines from this source
24+
// context.goNamed('someSourceFeedRoute', params: {'id': source.id});
25+
ScaffoldMessenger.of(context).showSnackBar(
26+
SnackBar(content: Text('Tapped on source: ${source.name}')),
27+
);
28+
},
29+
);
30+
}
31+
}

0 commit comments

Comments
 (0)