is it possible to expand Column content, to keep content centered, but make it scrollable at the same time, if needed? I've tried following:
Copy code
Column(
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))
}
}
s
Stylianos Gakis
08/02/2023, 1:12 PM
Does this work for you?
Copy code
Column(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.
p
Peter Mandeljc
08/02/2023, 1:54 PM
Hm, that works, thanks. I've managed to also find alternative solution