Skip to content

Commit

Permalink
Handle nullable seed colors
Browse files Browse the repository at this point in the history
  • Loading branch information
msasikanth committed Aug 14, 2024
1 parent b64867a commit 8036d1d
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ internal fun FeaturedSection(
systemBarsEndPadding
}

val defaultSeedColor = AppTheme.colorScheme.tintedForeground

LaunchedEffect(pagerState, featuredPosts) {
snapshotFlow {
val settledPage = pagerState.settledPage
Expand Down Expand Up @@ -148,9 +150,14 @@ internal fun FeaturedSection(
currentItem
}

val fromSeedColor =
fromItem.seedColor.run { if (this != null) Color(this) else defaultSeedColor }
val toSeedColor =
toItem.seedColor.run { if (this != null) Color(this) else defaultSeedColor }

dynamicColorState.animate(
fromSeedColor = Color(fromItem.seedColor!!),
toSeedColor = Color(toItem.seedColor!!),
fromSeedColor = fromSeedColor,
toSeedColor = toSeedColor,
progress = offset
)
}
Expand Down

0 comments on commit 8036d1d

Please sign in to comment.