Skip to content

Commit 443ae38

Browse files
committed
feat(headlines-feed): implement BlocProvider in SourceFilterPage
- Add required HeadlinesFilterBloc parameter to SourceFilterPage constructor - Implement BlocProvider to pass the existing filterBloc to the subtree - Update documentation to reflect the new requirement and addition
1 parent 70028e5 commit 443ae38

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

lib/headlines-feed/view/source_filter_page.dart

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,20 @@ import 'package:ui_kit/ui_kit.dart';
1919
/// {@endtemplate}
2020
class SourceFilterPage extends StatelessWidget {
2121
/// {@macro source_filter_page}
22-
const SourceFilterPage({super.key});
22+
///
23+
/// Requires the [filterBloc] instance passed from the parent route.
24+
const SourceFilterPage({required this.filterBloc, super.key});
25+
26+
/// The instance of [HeadlinesFilterBloc] provided by the parent route.
27+
final HeadlinesFilterBloc filterBloc;
2328

2429
@override
2530
Widget build(BuildContext context) {
26-
return const _SourceFilterView();
31+
// Provide the existing filterBloc to this subtree.
32+
return BlocProvider.value(
33+
value: filterBloc,
34+
child: const _SourceFilterView(),
35+
);
2736
}
2837
}
2938

0 commit comments

Comments
 (0)