Skip to content

Comments

fix: Support for Dark Mode by removing hardcoded colors#22

Merged
ngocvuphan merged 2 commits intongocvuphan:mainfrom
AbRa734:feature/colors
Feb 24, 2026
Merged

fix: Support for Dark Mode by removing hardcoded colors#22
ngocvuphan merged 2 commits intongocvuphan:mainfrom
AbRa734:feature/colors

Conversation

@AbRa734
Copy link

@AbRa734 AbRa734 commented Feb 19, 2026

What does this PR do?

This PR fixes an issue where the date picker's text and navigation icons become completely unreadable when the parent application uses a Dark Theme.

The Problem

Currently, the package hardcodes Colors.black for text styles (e.g., theme.textTheme.bodySmall?.copyWith(color: Colors.black)) and relies on default unstyled colors for action icons. When the app switches to Dark Mode and the calendar background adapts to a darker color, the black text and icons blend into the background, making the UI unusable.

The Solution

  • Replaced all hardcoded instances of Colors.black with theme.colorScheme.onSurface.
  • Updated the _iconWidget method to fall back to theme.colorScheme.onSurface if no specific color is provided.

Result

The vph_web_date_picker now natively respects the Material 3 Theme provided by the parent application. It automatically renders black text/icons in Light Mode and white/light gray text/icons in Dark Mode, ensuring perfect readability in all scenarios. No functional logic has been changed.

@ngocvuphan ngocvuphan merged commit 839ed76 into ngocvuphan:main Feb 24, 2026
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