Scroll the list to the bottom when the keyboard is fully shown in Compose
01:02 25 Jun 2025

How to scroll the list to the bottom when keyboard is shown in Compose? Now I have the following solution:

val isImeVisible = WindowInsets.isImeVisible

LaunchedEffect(isImeVisible) {
        if (isImeVisible) {
            coroutineScope.launch {
                delay(100)
                scrollState.animateScrollTo(scrollState.maxValue)
            }
        }
    }

But it does not work sometimes because isImeVisible is getting triggered early. I can increase the delay, but still is not a best solution I believe. Any bulletproof solutions here?

android kotlin android-jetpack-compose ime android-compose-layout