Merged
Conversation
- Add `ThemeRepository` to handle dark mode preference using DataStore. - Update `TodoAppTheme` to support both light and dark color schemes. - Refactor UI components to use `MaterialTheme.colorScheme` instead of hardcoded colors for better theme adaptation. - Integrate theme switching logic into `SettingsViewModel` and add a toggle switch in `SettingsPage`. - Update `OnBoardingScreen` background to support dynamic theme gradients. - Inject `ThemeRepository` in the main `App` entry point to observe and apply the current theme.
- Update `SelectionCard` and `EditDetailCard` to use `MaterialTheme.colorScheme.onSurface`. - Update `DatePickerDialog` to use `MaterialTheme.colorScheme.surface`. - Refactor `MonthlyCalendar` to use `Surface` with `MaterialTheme.colorScheme.surface` instead of a `Box` with hardcoded background.
Contributor
There was a problem hiding this comment.
Pull request overview
Implements app-wide dark theme support in the Compose Multiplatform UI, including a Settings toggle persisted via DataStore and wiring the selected theme into the root App() theme wrapper.
Changes:
- Added a dark color palette and conditional dark/light
ColorSchemeselection inTodoAppTheme. - Introduced DataStore-backed
ThemeRepository, exposed viaSettingsViewModel, and added a dark mode toggle UI in Settings. - Updated multiple UI components to use
MaterialTheme.colorSchemesurfaces instead of hard-coded light colors.
Reviewed changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| README.md | Removes extra blank lines in README content. |
| composeApp/src/commonMain/kotlin/io/jadu/todoApp/ui/viewModel/SettingsViewModel.kt | Injects theme repository; exposes isDarkMode and toggle action. |
| composeApp/src/commonMain/kotlin/io/jadu/todoApp/ui/theme/TodoColors.kt | Adds dark-theme palette entries. |
| composeApp/src/commonMain/kotlin/io/jadu/todoApp/ui/theme/TodoAppTheme.kt | Adds dark scheme + LocalDarkTheme; switches scheme by darkTheme. |
| composeApp/src/commonMain/kotlin/io/jadu/todoApp/ui/screens/SettingsPage.kt | Adds dark mode switch card; updates dialog surface color for theming. |
| composeApp/src/commonMain/kotlin/io/jadu/todoApp/ui/screens/OnBoardingScreen.kt | Uses LocalDarkTheme to swap onboarding background gradient for dark mode. |
| composeApp/src/commonMain/kotlin/io/jadu/todoApp/ui/screens/homescreen/components/TaskProgressCard.kt | Uses themed surface/onSurface for button colors. |
| composeApp/src/commonMain/kotlin/io/jadu/todoApp/ui/components/TodoElevatedCard.kt | Uses themed surface background. |
| composeApp/src/commonMain/kotlin/io/jadu/todoApp/ui/components/SelectTaskStatusBottomSheet.kt | Uses themed surface for bottom sheet container. |
| composeApp/src/commonMain/kotlin/io/jadu/todoApp/ui/components/SelectionCard.kt | Uses themed onSurface for text. |
| composeApp/src/commonMain/kotlin/io/jadu/todoApp/ui/components/SelectGroupBottomSheet.kt | Uses themed surface for bottom sheet container. |
| composeApp/src/commonMain/kotlin/io/jadu/todoApp/ui/components/MonthlyCalendar.kt | Replaces hard-coded white background with themed Surface. |
| composeApp/src/commonMain/kotlin/io/jadu/todoApp/ui/components/EditDetailCard.kt | Uses themed surface/onSurface instead of fixed colors. |
| composeApp/src/commonMain/kotlin/io/jadu/todoApp/ui/components/DatePickerDialog.kt | Uses themed surface for dialog background. |
| composeApp/src/commonMain/kotlin/io/jadu/todoApp/ui/components/CustomDialog.kt | Uses themed surface/onSurface for button colors. |
| composeApp/src/commonMain/kotlin/io/jadu/todoApp/data/local/ThemeRepository.kt | New DataStore-backed theme preference repository. |
| composeApp/src/commonMain/kotlin/io/jadu/di.kt | Registers ThemeRepository and updates SettingsViewModel DI wiring. |
| composeApp/src/commonMain/kotlin/io/jadu/App.kt | Injects theme repository and applies darkTheme at app root. |
| composeApp/src/commonMain/composeResources/values/strings.xml | Adds strings for dark mode toggle. |
| androidApp/src/main/java/io/jadu/MainActivity.kt | Removes Surface wrapper so app theme controls background. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
composeApp/src/commonMain/kotlin/io/jadu/todoApp/data/local/ThemeRepository.kt
Outdated
Show resolved
Hide resolved
composeApp/src/commonMain/kotlin/io/jadu/todoApp/data/local/ThemeRepository.kt
Outdated
Show resolved
Hide resolved
composeApp/src/commonMain/kotlin/io/jadu/todoApp/ui/screens/SettingsPage.kt
Outdated
Show resolved
Hide resolved
composeApp/src/commonMain/kotlin/io/jadu/todoApp/ui/theme/TodoAppTheme.kt
Show resolved
Hide resolved
Owner
|
@Diwakarchavan please review the comments |
Contributor
Author
Okay, I'll address all the comments tomorrow. |
- Modify `ThemeRepository` and `SettingsViewModel` to use a nullable `Boolean` for `isDarkMode`, allowing the detection of an unset preference. - Update `App.kt` and `SettingsPage.kt` to fallback to `isSystemInDarkTheme()` when no explicit user preference is stored. - Add `resetToSystem()` to `ThemeRepository` to allow clearing the dark mode preference. - Remove unused `TodoColors` import in `DatePickerDialog.kt`.
- Catch exceptions in `dataStore.data` and emit `emptyPreferences()` to prevent flow failures.
- Update `DARK_MODE_KEY` to follow camelCase naming convention for the private property. - Refactor all references to use the renamed `darkModeKey`.
- Update `DARK_MODE_KEY` to follow camelCase naming convention for the private property. - Refactor all references to use the renamed `darkModeKey`.
- Update `DARK_MODE_KEY` to follow camelCase naming convention for the private property. - Refactor all references to use the renamed `darkModeKey`.
- Move the color scheme initialization before the typography definition in `TodoAppTheme.kt`. - Update `Typography` styles to use the local `colors.onSurface` instead of `MaterialTheme.colorScheme.onSurface` to ensure consistency during theme transitions.
- Remove unused `isSystemInDarkTheme` import. - Prevent UI flicker by ensuring `TodoAppTheme` only renders once the `isDarkMode` preference is loaded from the repository.
…heme-setup # Conflicts: # composeApp/src/commonMain/kotlin/io/jadu/App.kt
- Remove unused `rememberNavController` and its import in `App.kt`. - Update `MainScreen` call to no longer require a `navController` argument.
Rohit-554
approved these changes
Apr 12, 2026
Owner
|
@Diwakarchavan Thanks for your contribution !! Tip for next time contribution : add the screen shots if you are working on UI Tasks |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#1