Scaffold: Fix snackbar bottom inset (#9052)

This commit is contained in:
Ivan Iskandar 2023-02-08 21:37:12 +07:00 committed by GitHub
parent ad762f8303
commit 34a586ce48
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -240,13 +240,16 @@ private fun ScaffoldLayout(
) )
}.fastMap { it.measure(looseConstraints) } }.fastMap { it.measure(looseConstraints) }
val bottomBarHeight = bottomBarPlaceables.fastMaxBy { it.height }?.height val bottomBarHeight = bottomBarPlaceables
.fastMaxBy { it.height }
?.height
?.takeIf { it != 0 }
val fabOffsetFromBottom = fabPlacement?.let { val fabOffsetFromBottom = fabPlacement?.let {
max(bottomBarHeight ?: 0, bottomInset) + it.height + FabSpacing.roundToPx() max(bottomBarHeight ?: 0, bottomInset) + it.height + FabSpacing.roundToPx()
} }
val snackbarOffsetFromBottom = if (snackbarHeight != 0) { val snackbarOffsetFromBottom = if (snackbarHeight != 0) {
snackbarHeight + (fabOffsetFromBottom ?: bottomBarHeight ?: bottomInset) snackbarHeight + (fabOffsetFromBottom ?: max(bottomBarHeight ?: 0, bottomInset))
} else { } else {
0 0
} }