Filip Stanis
01/25/2022, 6:32 PMTextField
in a scrollable column and I realized that by default the column won't scroll to the bottom if it goes off screen. Attached gif of what I mean - the TextField
grows until it reached the height of the Column
, then it goes off-screen - but I can still scroll to it. Can I make the scroll position follow focus? I'd expected that to happen by default, maybe I'm doing something wrong?
val scrollState by remember { mutableStateOf(ScrollState(0)) }
var value by remember { mutableStateOf("") }
Column(
Modifier
.padding(8.dp)
.height(60.dp)
.verticalScroll(scrollState)
) {
BasicTextField(
modifier = Modifier
.fillMaxWidth()
.background(Color.White)
.padding(8.dp),
value = value,
onValueChange = { value = it }
)
}
scrollTo(Int.MAX_VALUE)
on every change of text. Not sure if that's ideal though.