Created
March 4, 2023 23:30
-
-
Save fvilarino/1514f0053e590b398db2a5addf6f4493 to your computer and use it in GitHub Desktop.
Ticker - Bottom Half
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Composable | |
private fun BottomHalf( | |
modifier: Modifier = Modifier, | |
content: @Composable () -> Unit, | |
) { | |
Layout( | |
modifier = modifier.clipToBounds(), | |
content = content, | |
) { measurables, constraints -> | |
require(measurables.size == 1) { "This composable expects a single child" } | |
val placeable = measurables.first().measure(constraints) | |
val height = placeable.height / 2 | |
layout( | |
width = placeable.width, | |
height = height, | |
) { | |
placeable.placeRelative( | |
x = 0, | |
// 1 | |
y = -height, | |
) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment