Skip to content

Commit d7ecf44

Browse files
ashnohealexvanyo
andauthored
Update SystemBarProtectionSnippets.kt
Call lambda in the draw phase to reduce recompositions. Co-authored-by: Alex Vanyo <[email protected]>
1 parent 372d677 commit d7ecf44

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

compose/snippets/src/main/java/com/example/compose/snippets/layouts/SystemBarProtectionSnippets.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,8 @@ private fun StatusBarProtection(
8080
heightProvider: () -> Float = calculateGradientHeight(),
8181
) {
8282

83-
val calculatedHeight = heightProvider()
84-
8583
Canvas(Modifier.fillMaxSize()) {
84+
val calculatedHeight = heightProvider()
8685
val gradient = Brush.verticalGradient(
8786
colors = listOf(
8887
color.copy(alpha = 1f),

0 commit comments

Comments
 (0)