Skip to content

feat: implement global theme switcher and dark mode support#38

Open
Amadeusz-P wants to merge 1 commit into
matisiekpl:mainfrom
Amadeusz-P:feat/theme-switcher
Open

feat: implement global theme switcher and dark mode support#38
Amadeusz-P wants to merge 1 commit into
matisiekpl:mainfrom
Amadeusz-P:feat/theme-switcher

Conversation

@Amadeusz-P

Copy link
Copy Markdown
Contributor

This Pull Request introduces a global theme switcher, allowing users to toggle between Light Mode and Dark Mode. While the user-facing feature is straightforward, its implementation required a substantial amount of refactoring and underlying architecture changes ("plumbing") to ensure that theme state changes propagate cleanly across all application layers, map tiles, and custom widgets.
Key Changes & Architecture Breakdown

  1. State Management & Plumbing for Theme Configuration

    Global Theme State: Introduced a state notifier / provider to manage the user's selected theme preference across the app lifecycle.

    Persistent Settings: Integrated local storage mapping to ensure the chosen theme preference persists across application restarts.

    Context Propagation: Updated the root configuration (MaterialApp or equivalent) to dynamically rebuild and apply properties based on the active theme state.

  2. UI & Component Restructuring

    Widget Modernization: Refactored a large number of hardcoded color properties in existing views and dialogs to use semantic colors from Theme.of(context) (e.g., colorScheme.surface, colorScheme.onSurface).

    Theme Switcher Control: Added an intuitive toggle button/option inside the user interface settings to trigger the switch.

  3. Map Customization & Integration

    Adaptive Map Styling: Connected the theme switcher to the map rendering layer. The application now swaps map source tiles or applies specialized dark/light styling configurations dynamically to match the active system mode, protecting user night vision during emergencies.

Why are there so many files changed?

To prevent a fragmented user experience, every custom card, bottom sheet, and map element had to be adapted to drop hardcoded styles and instead listen to the central theme state. This ensures strict UI consistency when flipping the toggle.
Type of Change

[x] ✨ New feature (non-breaking change which adds functionality)

[x] ♻️ Refactor / Code plumbing (widespread structural updates for theme support)
Screenshot_2026-05-23-12-49-12-816_pl enteam aed_map Screenshot_2026-05-23-12-49-01-916_pl enteam aed_map

@netlify

netlify Bot commented May 23, 2026

Copy link
Copy Markdown

👷 Deploy request for aedmap pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 48fc053

@matisiekpl

Copy link
Copy Markdown
Owner

I'm open to debate here, but I don't feel this feature is needed. Goal of the app is make it zero-config driven as much as possible. After receiving more than 200+ feedback messages, no one mentioned that this feature is missing.

I don't feel that codebase expansion justifies value.

@Amadeusz-P

Copy link
Copy Markdown
Contributor Author

I'm open to debate here, but I don't feel this feature is needed. Goal of the app is make it zero-config driven as much as possible. After receiving more than 200+ feedback messages, no one mentioned that this feature is missing.

I don't feel that codebase expansion justifies value.

From my experience, older users are often particular about this, so adding an option to change it is a valuable accessibility update. And accessibility would also be necessary if the city plans to promote the app via social media. In fact, this is exactly why I'm submitting these PRs—my city has recently greenlit AEDs in public spaces as part of a multi-year revitalization plan.

@matisiekpl

Copy link
Copy Markdown
Owner

And accessibility would also be necessary if the city plans to promote the app via social media.

Which accessiblity guidelines requires this? WCAG does not.

older users are often particular about this

Okey, but don't you think that system theme sync is already an easier solution for older people?

@Amadeusz-P

Amadeusz-P commented May 23, 2026

Copy link
Copy Markdown
Contributor Author

Which accessiblity guidelines requires this? WCAG does not.

Doesn't WCAG mention something about the ability for users to select foreground and background colors?

But that's beside the point. Having a default dark theme without the ability to change it may cause a problematic situation when using a phone in direct sunlight; also, using a dark theme outside may bring problems to users with poorer eyesight. While adding this toggle does not take away from the simplicity of the app—the default is the system setting—it definitely adds to its broader usage.

@matisiekpl

Copy link
Copy Markdown
Owner

Doesn't WCAG mention something about the ability for users to select foreground and background colors?

Mentions. And the ability to set this is available via system theme switcher.

Having a default dark theme without the ability to change it may cause a problematic situation when using a phone in direct sunlight; also, using a dark theme outside may bring problems to users with poorer eyesight.

I agree, but the ability is already delivered by system theme switcher.

While adding this toggle does not take away from the simplicity of the app

Nope, it adds complexity, one more thing in the settings list, 349 lines added to codebase. This feature comes at the cost. And I don't think value justifies the cost here.

The only real use case is when user wants to for example select light mode in app, when rest of the phone system is in dark mode. I feel it is extremely rare use case, and it does not justifies the cost.

App is already WCAG-compliant. What other value besides the usecase described above, this feature delivers?

@Amadeusz-P

Amadeusz-P commented May 25, 2026

Copy link
Copy Markdown
Contributor Author

App is already WCAG-compliant. What other value besides the usecase described above, this feature delivers?

I really think the use case mentioned earlier is crucial in life-saving situations. I completely disagree that it's a rare use case. Example bellow isn't great but I think that diffrence is substantial.
Messenger_creation_7735B16E-06A8-4D55-A1A3-CDCA454ABA77
Messenger_creation_6F2E7E47-7B54-4C7E-95CA-C38E4427CB9F

@matisiekpl

Copy link
Copy Markdown
Owner

@Amadeusz-P But why can't you just switch system theme in such case?
App DOES have support for multiple themes, the only thing is I don't think we need one extra button for this, while system theme toggle does the job.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants