@@ -369,6 +369,180 @@ GoRouter createRouter({
369369 );
370370 },
371371 ),
372+ // --- Account-related routes (Top-Level Modals) ---
373+ // These routes are for pages launched from the AccountSheet. They are
374+ // defined at the top level and use `fullscreenDialog: true` to be
375+ // presented modally over the entire app, including the AppShell.
376+
377+ // ShellRoute for settings to provide SettingsBloc to children
378+ ShellRoute (
379+ builder: (
380+ BuildContext context,
381+ GoRouterState state,
382+ Widget child,
383+ ) {
384+ final appBloc = context.read <AppBloc >();
385+ final userId = appBloc.state.user? .id;
386+
387+ return BlocProvider <SettingsBloc >(
388+ create: (context) {
389+ final settingsBloc = SettingsBloc (
390+ userAppSettingsRepository:
391+ context.read <DataRepository <UserAppSettings >>(),
392+ inlineAdCacheService: inlineAdCacheService,
393+ );
394+ if (userId != null ) {
395+ settingsBloc.add (
396+ SettingsLoadRequested (userId: userId),
397+ );
398+ } else {
399+ logger.warning (
400+ 'User ID is null when creating SettingsBloc. '
401+ 'Settings will not be loaded.' ,
402+ );
403+ }
404+ return settingsBloc;
405+ },
406+ child: child,
407+ );
408+ },
409+ routes: [
410+ GoRoute (
411+ path: Routes .settings,
412+ name: Routes .settingsName,
413+ pageBuilder: (context, state) => const MaterialPage (
414+ fullscreenDialog: true ,
415+ child: SettingsPage (),
416+ ),
417+ routes: [
418+ GoRoute (
419+ path: Routes .settingsAppearance,
420+ name: Routes .settingsAppearanceName,
421+ builder: (context, state) => const AppearanceSettingsPage (),
422+ routes: [
423+ GoRoute (
424+ path: Routes .settingsAppearanceTheme,
425+ name: Routes .settingsAppearanceThemeName,
426+ builder: (context, state) => const ThemeSettingsPage (),
427+ ),
428+ GoRoute (
429+ path: Routes .settingsAppearanceFont,
430+ name: Routes .settingsAppearanceFontName,
431+ builder: (context, state) => const FontSettingsPage (),
432+ ),
433+ ],
434+ ),
435+ GoRoute (
436+ path: Routes .settingsFeed,
437+ name: Routes .settingsFeedName,
438+ builder: (context, state) => const FeedSettingsPage (),
439+ ),
440+ GoRoute (
441+ path: Routes .settingsNotifications,
442+ name: Routes .settingsNotificationsName,
443+ builder: (context, state) => const NotificationSettingsPage (),
444+ ),
445+ GoRoute (
446+ path: Routes .settingsLanguage,
447+ name: Routes .settingsLanguageName,
448+ builder: (context, state) => const LanguageSettingsPage (),
449+ ),
450+ ],
451+ ),
452+ ],
453+ ),
454+ GoRoute (
455+ path: Routes .manageFollowedItems,
456+ name: Routes .manageFollowedItemsName,
457+ pageBuilder: (context, state) => const MaterialPage (
458+ fullscreenDialog: true ,
459+ child: ManageFollowedItemsPage (),
460+ ),
461+ routes: [
462+ GoRoute (
463+ path: Routes .followedTopicsList,
464+ name: Routes .followedTopicsListName,
465+ builder: (context, state) => const FollowedTopicsListPage (),
466+ routes: [
467+ GoRoute (
468+ path: Routes .addTopicToFollow,
469+ name: Routes .addTopicToFollowName,
470+ builder: (context, state) => const AddTopicToFollowPage (),
471+ ),
472+ ],
473+ ),
474+ GoRoute (
475+ path: Routes .followedSourcesList,
476+ name: Routes .followedSourcesListName,
477+ builder: (context, state) => const FollowedSourcesListPage (),
478+ routes: [
479+ GoRoute (
480+ path: Routes .addSourceToFollow,
481+ name: Routes .addSourceToFollowName,
482+ builder: (context, state) => const AddSourceToFollowPage (),
483+ ),
484+ ],
485+ ),
486+ GoRoute (
487+ path: Routes .followedCountriesList,
488+ name: Routes .followedCountriesListName,
489+ builder: (context, state) => const FollowedCountriesListPage (),
490+ routes: [
491+ GoRoute (
492+ path: Routes .addCountryToFollow,
493+ name: Routes .addCountryToFollowName,
494+ builder: (context, state) => const AddCountryToFollowPage (),
495+ ),
496+ ],
497+ ),
498+ ],
499+ ),
500+ GoRoute (
501+ path: Routes .accountSavedHeadlines,
502+ name: Routes .accountSavedHeadlinesName,
503+ pageBuilder: (context, state) => const MaterialPage (
504+ fullscreenDialog: true ,
505+ child: SavedHeadlinesPage (),
506+ ),
507+ routes: [
508+ GoRoute (
509+ path: Routes .accountArticleDetails,
510+ name: Routes .accountArticleDetailsName,
511+ builder: (context, state) {
512+ final headlineFromExtra = state.extra as Headline ? ;
513+ final headlineIdFromPath = state.pathParameters['id' ];
514+ return MultiBlocProvider (
515+ providers: [
516+ BlocProvider (
517+ create: (context) => HeadlineDetailsBloc (
518+ headlinesRepository:
519+ context.read <DataRepository <Headline >>(),
520+ ),
521+ ),
522+ BlocProvider (
523+ create: (context) => SimilarHeadlinesBloc (
524+ headlinesRepository:
525+ context.read <DataRepository <Headline >>(),
526+ ),
527+ ),
528+ ],
529+ child: HeadlineDetailsPage (
530+ initialHeadline: headlineFromExtra,
531+ headlineId: headlineFromExtra? .id ?? headlineIdFromPath,
532+ ),
533+ );
534+ },
535+ ),
536+ ],
537+ ),
538+ GoRoute (
539+ path: Routes .accountSavedFilters,
540+ name: Routes .accountSavedFiltersName,
541+ pageBuilder: (context, state) => const MaterialPage (
542+ fullscreenDialog: true ,
543+ child: SavedFiltersPage (),
544+ ),
545+ ),
372546 // --- Main App Shell ---
373547 StatefulShellRoute .indexedStack (
374548 builder: (context, state, navigationShell) {
0 commit comments