8000 feat(settings): let the default page on launch be any section by ahmet-cetinkaya · Pull Request #307 · ahmet-cetinkaya/whph · GitHub
[go: up one dir, main page]

Skip to content

feat(settings): let the default page on launch be any section - #307

Merged
ahmet-cetinkaya merged 2 commits into
mainfrom
feat/default-page-setting
Sep 6, 2026
Merged

ahmet-cetinkaya merged 2 commits into
mainfrom
feat/default-page-setting

Conversation

@ahmet-cetinkaya
Copy link
Copy Markdown
Owner

🚀 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.topNavItems rather than a second hand-maintained list, so a section added to the navigation becomes selectable without touching the setting.

main() reads the stored route before runApp and passes it to App. 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 --> F
Loading

Two things worth a reviewer's attention:

Important

The first page is set with home:, not initialRoute:. initialRoute: also generates a route for /, which AppRoutes maps 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:

Stored value Page opened
/tasks TasksPage
/habits HabitsPage
/a-removed-page TodayPage

Note

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

  • Tests passed locally — 26 new/related tests green; full suite green apart from two desktop_server_sync_service failures that reproduce identically on origin/main and are unrelated to this change.
  • Commit history is clean and descriptive.
  • Documentation updated (if applicable) — N/A; no user-facing docs cover settings.
  • Code quality standards met — rps format clean, fvm flutter analyze reports no issues, rps test:locale confirms all 22 locales complete.

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.
@ahmet-cetinkaya ahmet-cetinkaya added enhancement New feature or request ui User interface and user experience issues labels Sep 6, 2026
@ahmet-cetinkaya ahmet-cetinkaya self-assigned this Sep 6, 2026
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.
@ahmet-cetinkaya
ahmet-cetinkaya marked this pull request as ready for review September 6, 2026 13:38
@ahmet-cetinkaya
ahmet-cetinkaya merged commit 75a0b3e into main Sep 6, 2026
3 checks passed
@ahmet-cetinkaya
ahmet-cetinkaya deleted the feat/default-page-setting branch September 6, 2026 13:50
@ahmet-cetinkaya
Copy link
Copy Markdown
Owner Author

Merged as 75a0b3ef. Settings → General now has a Default page, and #306 closed with it — the last open item from the #215 feedback batch.

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 home: builds the first page without a name, so it 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 filled the whole window and its content touched the edges. DialogSize.min hands the child back unwrapped, so it never sat in a dialog at all — and on mobile it would have opened as a plain dialog instead of a bottom sheet. DialogSize.medium fits a six-entry list.

The picker did not look like the rest of Settings. The entries are now styled like LanguageSelectDialog: cards with horizontal margins, a raised card and check_circle for the selected page, radio_button_unchecked for the others.


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 App really calls. Both were rewritten until the mutants died.

The navigation-bar fix was confirmed against the running Linux binary (currentRoute=/tasks, only Tasks active) and in a screenshot. The dialog's new styling was not verified by eye — the automated clicks turned out to be blocked behind an input-permission prompt, so padding and card layout rest on widget tests alone. Worth a glance next time Settings is open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request ui User interface and user experience issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] Let the default page on launch be any section, not only Today

1 participant

0