Peter Mandeljc
08/02/2023, 12:45 PMColumn(
modifier = Modifier
.fillMaxSize()
// If I comment vertical scroll, it does what I want
.verticalScroll(rememberScrollState()),
) {
// I want to keep this on top
Text(text = "title")
// I want this to be expanded and centered
Box(modifier = Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {
Box(modifier = Modifier.size(300.dp).background(Color.Blue))
}
}
Stylianos Gakis
08/02/2023, 1:12 PMColumn(fillMaxSize.verticalScroll()) {
Text()
Spacer(Modifier.weight(1f))
Your content here
Spacer(Modifier.weight(1f))
}
If the inner content is enough to make the column scrollable, the weights will then take up 0dp in height.Peter Mandeljc
08/02/2023, 1:54 PMColumn(
modifier = Modifier
.fillMaxSize()
.verticalScroll(rememberScrollState())
,
) {
Text(text = "title")
Box(modifier = Modifier.wrapContentSize().weight(1f)) {
Box(
modifier = Modifier
.size(500.dp)
.background(Color.Red),
)
}
}
Stylianos Gakis
08/02/2023, 2:05 PMAlbert Chang
08/02/2023, 3:25 PMverticalArrangement = Arrangement.SpaceBetween
on the column should be enough.