Skip to content

Commit

Permalink
📝 doc
Browse files Browse the repository at this point in the history
  • Loading branch information
CXwudi committed Dec 13, 2023
1 parent a7028a9 commit 84c3dd5
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,17 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.layout.SubcomposeLayout


/**
* Column with specialized spacing for the first item using [SubcomposeLayout]
*/
@Composable
fun ColumnThatResizesFirstItem(
modifier: Modifier = Modifier,
spacing: Int = 0,
content: @Composable () -> Unit
) {
// see https://foso.github.io/Jetpack-Compose-Playground/ui/layout/subcomposelayout/
// and https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/package-summary#SubcomposeLayout(androidx.compose.ui.Modifier,kotlin.Function2)
SubcomposeLayout(modifier = modifier) { constraints ->
val placeables = subcompose(ColumnItem.Main, content).map {
it.measure(constraints.copy(minHeight = 0, minWidth = 0))
Expand Down

0 comments on commit 84c3dd5

Please sign in to comment.