Skip to content

Commit 70028e5

Browse files
committed
refactor(headlines-feed): improve country filter page architecture
- Add HeadlinesFilterBloc requirement to CountryFilterPage - Introduce _CountryFilterView widget for actual page content - Update documentation and widget tree structure
1 parent d5c57a8 commit 70028e5

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

lib/headlines-feed/view/country_filter_page.dart

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,36 @@ import 'package:ui_kit/ui_kit.dart';
1414
/// {@endtemplate}
1515
class CountryFilterPage extends StatelessWidget {
1616
/// {@macro country_filter_page}
17-
const CountryFilterPage({required this.title, super.key});
17+
///
18+
/// Requires a [title] for the app bar and the [filterBloc] instance
19+
/// passed from the parent route.
20+
const CountryFilterPage({
21+
required this.title,
22+
required this.filterBloc,
23+
super.key,
24+
});
1825

1926
/// The title to display in the app bar for this filter page.
2027
final String title;
2128

29+
/// The instance of [HeadlinesFilterBloc] provided by the parent route.
30+
final HeadlinesFilterBloc filterBloc;
31+
32+
@override
33+
Widget build(BuildContext context) {
34+
// Provide the existing filterBloc to this subtree.
35+
return BlocProvider.value(
36+
value: filterBloc,
37+
child: _CountryFilterView(title: title),
38+
);
39+
}
40+
}
41+
42+
class _CountryFilterView extends StatelessWidget {
43+
const _CountryFilterView({required this.title});
44+
45+
final String title;
46+
2247
@override
2348
Widget build(BuildContext context) {
2449
final l10n = AppLocalizationsX(context).l10n;

0 commit comments

Comments
 (0)