colintheshots
03/18/2022, 7:47 PMModifier.imePadding
or Modifier.navigationBarsWithImePadding
, the UI elements are scrolled completely offscreen and I’m left with a blank space where they were. I was able to workaround the issue by giving my textfield a weight of 1f and this keeps the buttons onscreen above the keyboard and below the textfield, but I can’t use this on screens with more than one textfield. Are there any alternatives to Modifier.weight(1f) that will work better here?Bradleycorn
03/18/2022, 8:22 PMbringIntoViewRequester
to bring the buttons into view when the text field is focused? maybe something like this:
val bringIntoViewRequester = bringIntoViewRequester()
TextField(..., modifier = Modifier.onFocusEvent {
if (it.isFocused || it.hasFocus) {
bringIntoViewRequester.bringIntoView()
}
})
...
Button(modifier = Modifier.bringIntoViewRequester(bringIntoViewRequester), ...)
colintheshots
03/18/2022, 8:39 PMZach Klippenstein (he/him) [MOD]
03/20/2022, 5:53 PM@Composable
fun Repro(modifier: Modifier = Modifier) {
var text by remember { mutableStateOf("") }
Column(modifier.windowInsetsPadding(WindowInsets.ime)) {
BasicTextField(
text,
onValueChange = { text = it },
modifier = Modifier
.fillMaxWidth()
.weight(1f)
)
Divider()
BasicText("toolbar goes here", Modifier.align(Alignment.CenterHorizontally))
}
}
I was using soft input mode ADJUST_RESIZE
and tried with decorFitsSystemWindows
both true and false, worked in both cases.colintheshots
03/21/2022, 2:38 PMZach Klippenstein (he/him) [MOD]
03/22/2022, 3:34 PMcolintheshots
03/22/2022, 3:41 PMZach Klippenstein (he/him) [MOD]
03/22/2022, 3:43 PMcolintheshots
03/22/2022, 3:44 PMZach Klippenstein (he/him) [MOD]
03/22/2022, 3:46 PMcolintheshots
03/22/2022, 3:50 PMZach Klippenstein (he/him) [MOD]
03/22/2022, 4:40 PMColumn {
Column(Modifier.weight(1f)) {
TextField(…)
// etc.
}
Toolbar()
}