Skip to content

Commit e7907f2

Browse files
committed
feat(headlines-feed): update TopicFilterPage to use provided filterBloc
- Modify TopicFilterPage to require a HeadlinesFilterBloc instance - Implement dependency injection for HeadlinesFilterBloc - Rename original TopicFilterPage to _TopicFilterView
1 parent 443ae38 commit e7907f2

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

lib/headlines-feed/view/topic_filter_page.dart

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,25 @@ import 'package:ui_kit/ui_kit.dart';
1414
/// {@endtemplate}
1515
class TopicFilterPage extends StatelessWidget {
1616
/// {@macro topic_filter_page}
17-
const TopicFilterPage({super.key});
17+
///
18+
/// Requires the [filterBloc] instance passed from the parent route.
19+
const TopicFilterPage({required this.filterBloc, super.key});
20+
21+
/// The instance of [HeadlinesFilterBloc] provided by the parent route.
22+
final HeadlinesFilterBloc filterBloc;
23+
24+
@override
25+
Widget build(BuildContext context) {
26+
// Provide the existing filterBloc to this subtree.
27+
return BlocProvider.value(
28+
value: filterBloc,
29+
child: const _TopicFilterView(),
30+
);
31+
}
32+
}
33+
34+
class _TopicFilterView extends StatelessWidget {
35+
const _TopicFilterView();
1836

1937
@override
2038
Widget build(BuildContext context) {

0 commit comments

Comments
 (0)