I want to scroll to a specific item inside a ScrollableColumn but how do I get the needed initial scrollValue without guessing it?
I want the scroll to start after the end of the composable TopAppBar
@ExperimentalMaterialApi
@Composable
fun Content(data: DataObj, onEditAction: () -> Unit) {
val items = listOf("a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "")
val scrollState = rememberScrollState(140f)
Surface(contentColor = Color.DarkGray) {
ScrollableColumn(scrollState = scrollState, modifier = Modifier.fillMaxSize()) {
TopAppBar(
title = { Text("Edit Entry") },
backgroundColor = Color.Transparent,
actions = {
IconButton(onClick = onEditAction) {
Icon(asset = Icons.Filled.Edit)
}
}
)
LazyColumnFor(items) { item ->
Surface(Modifier.preferredHeight(50.dp).fillMaxWidth()) {
Text(item)
}
}
}
}
}