Skip to content

Commit

Permalink
Fix: save state of seedColor as ColorInt instead of Long/ULong which …
Browse files Browse the repository at this point in the history
…is causing issue remember seedColor value (#154)

(cherry picked from commit d00be54)
  • Loading branch information
cuong-tran authored May 27, 2024
1 parent 574b377 commit 860d1d7
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import androidx.compose.runtime.saveable.listSaver
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.toArgb

/**
* Creates a [DynamicMaterialThemeState] that can be remembered across compositions.
Expand Down Expand Up @@ -132,7 +133,7 @@ public class DynamicMaterialThemeState internal constructor(
) = listSaver(
save = { state ->
listOf(
state.seedColor.value.toLong(),
state.seedColor.toArgb(),
state.isDark,
state.style.name,
state.contrastLevel,
Expand All @@ -141,7 +142,7 @@ public class DynamicMaterialThemeState internal constructor(
},
restore = { state ->
DynamicMaterialThemeState(
initialSeedColor = Color(state[0] as Long),
initialSeedColor = Color(state[0] as Int),
initialIsDark = state[1] as Boolean,
initialStyle = PaletteStyle.valueOf(state[2] as String),
initialContrastLevel = state[3] as Double,
Expand Down

0 comments on commit 860d1d7

Please sign in to comment.