Bottom sheet with textfield over lapping keyboard in jetpack compose android

42 Views Asked by At

When implementing bottom sheet with a text field and when the user is typing the keyboard will be visible. In that time the keyboard is hiding the button below the text field.

I want button to be visible when user typing.

I tried with ime padding but it get failed on certain device. Is there any solution for this?

1

There are 1 best solutions below

0
On

you can use the LocalWindowInsets and InsetsController APIs provided by Jetpack Compose. These APIs allow you to detect changes in the window insets



val windowInsets = LocalWindowInsets.current
    val imePadding = rememberInsetsPaddingValues(
        insets = windowInsets.ime,
        applyBottom = true
    )

and apply this padding to the column containing the text field and button.

Column(
        modifier = Modifier
            .padding(imePadding)
            .padding(12.dp)
    )