از انیمیشن های صفحه کلید IME استفاده کنید

می‌توانید Modifier.imeNestedScroll() را روی یک کانتینر اسکرول اعمال کنید تا IME هنگام اسکرول کردن به پایین کانتینر، به طور خودکار باز و بسته شود.

class WindowInsetsExampleActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

        WindowCompat.setDecorFitsSystemWindows(window, false)

        setContent {
            MaterialTheme {
                MyScreen()
            }
        }
    }
}

@OptIn(ExperimentalLayoutApi::class)
@Composable
fun MyScreen() {
    Box {
        LazyColumn(
            modifier = Modifier
                .fillMaxSize() // fill the entire window
                .imePadding() // padding for the bottom for the IME
                .imeNestedScroll(), // scroll IME at the bottom
            content = { }
        )
        FloatingActionButton(
            modifier = Modifier
                .align(Alignment.BottomEnd)
                .padding(16.dp) // normal 16dp of padding for FABs
                .navigationBarsPadding() // padding for navigation bar
                .imePadding(), // padding for when IME appears
            onClick = { }
        ) {
            Icon(imageVector = Icons.Filled.Add, contentDescription = "Add")
        }
    }
}

انیمیشنی که یک عنصر رابط کاربری را نشان می‌دهد که برای باز کردن راه برای صفحه‌کلید، به بالا و پایین اسکرول می‌کند
شکل ۳. انیمیشن‌های IME.