Skip to content

Commit

Permalink
shadows improved
Browse files Browse the repository at this point in the history
  • Loading branch information
T8RIN committed Apr 25, 2024
1 parent 4854883 commit 66545df
Showing 1 changed file with 33 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,30 +56,38 @@ fun Modifier.materialShadow(
}
val elev = animateDpAsState(if (enabled) elevation else 0.dp).value

val api29Shadow = if (isClipped) {
Modifier.clippedShadow(
shape = shape,
elevation = elev,
ambientColor = color,
spotColor = color
)
} else {
Modifier.shadow(
shape = shape,
elevation = elev,
ambientColor = color,
spotColor = color
)
}
if (elev > 0.dp) {
when {
isConcavePath && Build.VERSION.SDK_INT < Build.VERSION_CODES.Q -> {
val api21Shadow = Modifier.rsBlurShadow(
shape = shape,
radius = elev,
isAlphaContentClip = isClipped,
color = color
)

val api21shadow = Modifier.rsBlurShadow(
shape = shape,
radius = elev,
isAlphaContentClip = isClipped,
color = color
)
when {
isConcavePath && Build.VERSION.SDK_INT < Build.VERSION_CODES.Q -> api21shadow
else -> api29Shadow
}
api21Shadow
}

else -> {
val api29Shadow = if (isClipped) {
Modifier.clippedShadow(
shape = shape,
elevation = elev,
ambientColor = color,
spotColor = color
)
} else {
Modifier.shadow(
shape = shape,
elevation = elev,
ambientColor = color,
spotColor = color
)
}

api29Shadow
}
}
} else Modifier
}

0 comments on commit 66545df

Please sign in to comment.