Skip to content

Commit 935eb1a

Browse files
committed
feat: add category item widget
- Display category search result - Added onTap snackbar message
1 parent d13cf5d commit 935eb1a

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 Category model
3+
4+
/// A simple widget to display a Category search result.
5+
class CategoryItemWidget extends StatelessWidget {
6+
const CategoryItemWidget({required this.category, super.key});
7+
8+
final Category category;
9+
10+
@override
11+
Widget build(BuildContext context) {
12+
return ListTile(
13+
title: Text(category.name),
14+
subtitle: category.description != null
15+
? Text(
16+
category.description!,
17+
maxLines: 2,
18+
overflow: TextOverflow.ellipsis,
19+
)
20+
: null,
21+
// TODO(you): Implement onTap navigation if needed for categories
22+
onTap: () {
23+
// Example: Navigate to a filtered feed for this category
24+
// context.goNamed('someCategoryFeedRoute', params: {'id': category.id});
25+
ScaffoldMessenger.of(context).showSnackBar(
26+
SnackBar(content: Text('Tapped on category: ${category.name}')),
27+
);
28+
},
29+
);
30+
}
31+
}

0 commit comments

Comments
 (0)