Repository navigation
feat(settings): let the default page on launch be any section - #307
Conversation
The app always opened on Today. For anyone who does not schedule their tasks that page is close to empty, so every launch started with a navigation step to somewhere useful. Settings > General now offers a default page, listing the same sections as the navigation bar and defaulting to Today, so nothing changes for existing users. The choices are derived from NavigationItems rather than duplicated, so a section added to the navigation becomes selectable without touching the setting. Resolve the page with home: rather than initialRoute:. The latter also generates a route for '/', which AppRoutes maps to Today, which would leave the chosen page sitting on top of a page the user never asked for and hand Back somewhere unexpected. An unreadable or stale value falls back to Today at both ends: the read in main() cannot throw during startup, and a route that no longer exists resolves to the default page instead of leaving the tile blank.
Opening on a page other than Today left the navigation bar highlighting Today. The bar reads the current route to decide what to highlight, and home: builds the first page without a name, so the bar fell back to the first entry in the list. AppRoutes.buildInitialRoutes now produces one named route, which also keeps Flutter from expanding '/' into an extra Today page underneath the chosen one. The picker used DialogSize.min, which hands the child back unwrapped: it covered the whole window instead of sitting in a dialog, and on mobile it opened as a plain dialog rather than a bottom sheet. DialogSize.medium suits a six-entry list. Style the entries like LanguageSelectDialog - cards with horizontal margins so the content no longer touches the dialog edges, a raised card and check_circle for the selected page, radio_button_unchecked for the rest.
|
Merged as Three defects surfaced during review and were fixed on the branch before merge: The navigation bar highlighted Today no matter which page opened. The bar reads the current route to decide what to highlight, and The picker filled the whole window and its content touched the edges. The picker did not look like the rest of Settings. The entries are now styled like Two notes on how this was verified, for the record. Mutation testing was used to check the tests actually hold, and it earned its keep twice. The unknown-route guard was initially not covered — the mutant survived — and so was the route-naming fix, because that test exercised a copy of the routing config rather than the function The navigation-bar fix was confirmed against the running Linux binary ( |
🚀 Context
The app always opened on Today. For anyone who does not schedule their tasks that page is close to empty, so every launch started with a navigation step to get somewhere useful.
Settings → General now offers a Default page. It lists the same sections as the navigation bar and defaults to Today, so nothing changes for existing users unless they ask for it.
🔗 Related
⚙️ Implementation Details
The choices come from
NavigationItems.topNavItemsrather than a second hand-maintained list, so a section added to the navigation becomes selectable without touching the setting.main()reads the stored route beforerunAppand passes it toApp. Reading it later would show Today first and then jump, which is the flicker this feature exists to remove.flowchart LR A["main()"] -->|"reads DEFAULT_PAGE"| B{"stored route?"} B -->|"none / unreadable"| C["Today"] B -->|"/tasks"| D["pageForRoute"] D -->|"unknown route"| C D -->|"known route"| E["chosen page"] C --> F["home:"] E --> FTwo things worth a reviewer's attention:
Important
The first page is set with
home:, notinitialRoute:.initialRoute:also generates a route for/, whichAppRoutesmaps to Today — so the chosen page would sit on top of a Today page the user never asked for, and Back would land there. A test locks this in, and the reason is recorded in a comment so the "tidier" option is not reintroduced.A stale or unreadable value falls back to Today at both ends: the read in
main()cannot throw during startup, and a route that no longer resolves gives the default page instead of leaving the settings tile blank.Verification. Mutation testing was used to confirm the tests actually hold. The first version of the unknown-route guard was not covered — the mutant survived — so the test was strengthened until it failed. Beyond the suite, the Linux binary was built and run against stored settings:
/tasksTasksPage/habitsHabitsPage/a-removed-pageTodayPageNote
The settings tile itself was exercised through widget tests rather than by hand: the app window could not be raised programmatically under this Wayland session. The startup path above was verified against the running binary, so what is untried by hand is the tile's own tap-to-pick interaction.
📋 Checklist for Reviewer
desktop_server_sync_servicefailures that reproduce identically onorigin/mainand are unrelated to this change.rps formatclean,fvm flutter analyzereports no issues,rps test:localeconfirms all 22 locales complete.