Skip to content

Commit 389061b

Browse files
committed
feat(feed): add route for SourceListFilterPage
Updates the router to include a new route for the `SourceListFilterPage`. This route is nested under the main source filter page, allowing for navigation to the dedicated UI for filtering sources by headquarters and type.
1 parent 05cfc14 commit 389061b

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

lib/router/router.dart

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import 'package:flutter_news_app_mobile_client_full_source_code/headlines-feed/v
3333
import 'package:flutter_news_app_mobile_client_full_source_code/headlines-feed/view/headlines_feed_page.dart';
3434
import 'package:flutter_news_app_mobile_client_full_source_code/headlines-feed/view/headlines_filter_page.dart';
3535
import 'package:flutter_news_app_mobile_client_full_source_code/headlines-feed/view/manage_saved_filters_page.dart';
36+
import 'package:flutter_news_app_mobile_client_full_source_code/headlines-feed/view/source_list_filter_page.dart';
3637
import 'package:flutter_news_app_mobile_client_full_source_code/headlines-feed/view/source_filter_page.dart';
3738
import 'package:flutter_news_app_mobile_client_full_source_code/headlines-feed/view/topic_filter_page.dart';
3839
import 'package:flutter_news_app_mobile_client_full_source_code/headlines-search/bloc/headlines_search_bloc.dart';
@@ -475,6 +476,38 @@ GoRouter createRouter({
475476
state.extra! as HeadlinesFilterBloc;
476477
return SourceFilterPage(filterBloc: filterBloc);
477478
},
479+
routes: [
480+
GoRoute(
481+
path: 'source-list-filter',
482+
name: Routes.sourceListFilterName,
483+
builder: (context, state) {
484+
final extra =
485+
state.extra as Map<String, dynamic>? ?? {};
486+
final allCountries =
487+
extra['allCountries'] as List<Country>? ?? [];
488+
final allSourceTypes =
489+
extra['allSourceTypes'] as List<SourceType>? ??
490+
[];
491+
final initialSelectedHeadquarterCountries = extra[
492+
'initialSelectedHeadquarterCountries']
493+
as Set<Country>? ??
494+
{};
495+
final initialSelectedSourceTypes =
496+
extra['initialSelectedSourceTypes']
497+
as Set<SourceType>? ??
498+
{};
499+
500+
return SourceListFilterPage(
501+
allCountries: allCountries,
502+
allSourceTypes: allSourceTypes,
503+
initialSelectedHeadquarterCountries:
504+
initialSelectedHeadquarterCountries,
505+
initialSelectedSourceTypes:
506+
initialSelectedSourceTypes,
507+
);
508+
},
509+
),
510+
],
478511
),
479512
GoRoute(
480513
path: Routes.feedFilterEventCountries,

0 commit comments

Comments
 (0)