jordond/MaterialKolor

DynamicMaterialTheme won't update if system changes its dark mode

cuong-tran opened this issue · 2 comments

using isSystemInDarkTheme with DynamicMaterialTheme won't trigger a recomposition when system changes its dark mode.

On the other hand, using MaterialTheme with rememberDynamicColorScheme works fine.

Reason: isDark is being saved by rememberSaveable which won't update itself with new value from isSystemInDarkTheme.

Possible fix: don't save isDark, put it in DynamicMaterialThemeState.Saver instead.

Argue: fixing it that way works if App is setting isDark with isSystemDarkTheme but will then fail with other App that wants to remember isDark set by by user.

Suggestion: Opt-in for using remember instead of rememberSaveable in rememberDynamicMaterialThemeState. If one want to save any state during activity re-creation, he should implement it in his App.