@@ -376,25 +376,19 @@ GoRouter createRouter({
376376
377377 // ShellRoute for settings to provide SettingsBloc to children
378378 ShellRoute (
379- builder: (
380- BuildContext context,
381- GoRouterState state,
382- Widget child,
383- ) {
379+ builder: (BuildContext context, GoRouterState state, Widget child) {
384380 final appBloc = context.read <AppBloc >();
385381 final userId = appBloc.state.user? .id;
386382
387383 return BlocProvider <SettingsBloc >(
388384 create: (context) {
389385 final settingsBloc = SettingsBloc (
390- userAppSettingsRepository:
391- context .read <DataRepository <UserAppSettings >>(),
386+ userAppSettingsRepository: context
387+ .read <DataRepository <UserAppSettings >>(),
392388 inlineAdCacheService: inlineAdCacheService,
393389 );
394390 if (userId != null ) {
395- settingsBloc.add (
396- SettingsLoadRequested (userId: userId),
397- );
391+ settingsBloc.add (SettingsLoadRequested (userId: userId));
398392 } else {
399393 logger.warning (
400394 'User ID is null when creating SettingsBloc. '
@@ -515,14 +509,14 @@ GoRouter createRouter({
515509 providers: [
516510 BlocProvider (
517511 create: (context) => HeadlineDetailsBloc (
518- headlinesRepository:
519- context .read <DataRepository <Headline >>(),
512+ headlinesRepository: context
513+ .read <DataRepository <Headline >>(),
520514 ),
521515 ),
522516 BlocProvider (
523517 create: (context) => SimilarHeadlinesBloc (
524- headlinesRepository:
525- context .read <DataRepository <Headline >>(),
518+ headlinesRepository: context
519+ .read <DataRepository <Headline >>(),
526520 ),
527521 ),
528522 ],
@@ -706,179 +700,6 @@ GoRouter createRouter({
706700 ),
707701 ],
708702 ),
709- // --- Account-related routes (Nested under Feed) ---
710- // These routes are for pages launched from the AccountSheet, which
711- // is shown from the Feed page. Nesting them here ensures that
712- // go_router can navigate correctly from a context within the
713- // first shell branch.
714-
715- // ShellRoute for settings to provide SettingsBloc to children
716- ShellRoute (
717- builder:
718- (BuildContext context, GoRouterState state, Widget child) {
719- final appBloc = context.read <AppBloc >();
720- final userId = appBloc.state.user? .id;
721-
722- return BlocProvider <SettingsBloc >(
723- create: (context) {
724- final settingsBloc = SettingsBloc (
725- userAppSettingsRepository: context
726- .read <DataRepository <UserAppSettings >>(),
727- inlineAdCacheService: inlineAdCacheService,
728- );
729- if (userId != null ) {
730- settingsBloc.add (
731- SettingsLoadRequested (userId: userId),
732- );
733- } else {
734- logger.warning (
735- 'User ID is null when creating SettingsBloc. '
736- 'Settings will not be loaded.' ,
737- );
738- }
739- return settingsBloc;
740- },
741- child: child,
742- );
743- },
744- routes: [
745- GoRoute (
746- path: Routes .settings,
747- name: Routes .settingsName,
748- builder: (context, state) => const SettingsPage (),
749- routes: [
750- GoRoute (
751- path: Routes .settingsAppearance,
752- name: Routes .settingsAppearanceName,
753- builder: (context, state) =>
754- const AppearanceSettingsPage (),
755- routes: [
756- GoRoute (
757- path: Routes .settingsAppearanceTheme,
758- name: Routes .settingsAppearanceThemeName,
759- builder: (context, state) =>
760- const ThemeSettingsPage (),
761- ),
762- GoRoute (
763- path: Routes .settingsAppearanceFont,
764- name: Routes .settingsAppearanceFontName,
765- builder: (context, state) =>
766- const FontSettingsPage (),
767- ),
768- ],
769- ),
770- GoRoute (
771- path: Routes .settingsFeed,
772- name: Routes .settingsFeedName,
773- builder: (context, state) => const FeedSettingsPage (),
774- ),
775- GoRoute (
776- path: Routes .settingsNotifications,
777- name: Routes .settingsNotificationsName,
778- builder: (context, state) =>
779- const NotificationSettingsPage (),
780- ),
781- GoRoute (
782- path: Routes .settingsLanguage,
783- name: Routes .settingsLanguageName,
784- builder: (context, state) =>
785- const LanguageSettingsPage (),
786- ),
787- ],
788- ),
789- ],
790- ),
791- GoRoute (
792- path: Routes .manageFollowedItems,
793- name: Routes .manageFollowedItemsName,
794- builder: (context, state) => const ManageFollowedItemsPage (),
795- routes: [
796- GoRoute (
797- path: Routes .followedTopicsList,
798- name: Routes .followedTopicsListName,
799- builder: (context, state) => const FollowedTopicsListPage (),
800- routes: [
801- GoRoute (
802- path: Routes .addTopicToFollow,
803- name: Routes .addTopicToFollowName,
804- builder: (context, state) =>
805- const AddTopicToFollowPage (),
806- ),
807- ],
808- ),
809- GoRoute (
810- path: Routes .followedSourcesList,
811- name: Routes .followedSourcesListName,
812- builder: (context, state) =>
813- const FollowedSourcesListPage (),
814- routes: [
815- GoRoute (
816- path: Routes .addSourceToFollow,
817- name: Routes .addSourceToFollowName,
818- builder: (context, state) =>
819- const AddSourceToFollowPage (),
820- ),
821- ],
822- ),
823- GoRoute (
824- path: Routes .followedCountriesList,
825- name: Routes .followedCountriesListName,
826- builder: (context, state) =>
827- const FollowedCountriesListPage (),
828- routes: [
829- GoRoute (
830- path: Routes .addCountryToFollow,
831- name: Routes .addCountryToFollowName,
832- builder: (context, state) =>
833- const AddCountryToFollowPage (),
834- ),
835- ],
836- ),
837- ],
838- ),
839- GoRoute (
840- path: Routes .accountSavedHeadlines,
841- name: Routes .accountSavedHeadlinesName,
842- builder: (context, state) {
843- return const SavedHeadlinesPage ();
844- },
845- routes: [
846- GoRoute (
847- path: Routes .accountArticleDetails,
848- name: Routes .accountArticleDetailsName,
849- builder: (context, state) {
850- final headlineFromExtra = state.extra as Headline ? ;
851- final headlineIdFromPath = state.pathParameters['id' ];
852- return MultiBlocProvider (
853- providers: [
854- BlocProvider (
855- create: (context) => HeadlineDetailsBloc (
856- headlinesRepository: context
857- .read <DataRepository <Headline >>(),
858- ),
859- ),
860- BlocProvider (
861- create: (context) => SimilarHeadlinesBloc (
862- headlinesRepository: context
863- .read <DataRepository <Headline >>(),
864- ),
865- ),
866- ],
867- child: HeadlineDetailsPage (
868- initialHeadline: headlineFromExtra,
869- headlineId:
870- headlineFromExtra? .id ?? headlineIdFromPath,
871- ),
872- );
873- },
874- ),
875- ],
876- ),
877- GoRoute (
878- path: Routes .accountSavedFilters,
879- name: Routes .accountSavedFiltersName,
880- builder: (context, state) => const SavedFiltersPage (),
881- ),
882703 ],
883704 ),
884705 // --- Branch 2: Discover ---
0 commit comments