Android Compose extension.
- Keyboard show/hide extensions.
- Android System UI Controller
require android 14(target 34, compile 34)
Use gradle - compose 1.7.0-beta02, compose compiler 1.5.14, kotlin 1.9.24
implementation("tech.thdev:extensions-compose-keyboard-state:1.7.0-beta02")
implementation("tech.thdev:extensions-compose-system-ui-controller:1.7.0-beta02")
Use gradle - compose 1.6.7, compose compiler 1.5.13, kotlin 1.9.23
implementation("tech.thdev:extensions-compose-keyboard-state:1.6.7")
implementation("tech.thdev:extensions-compose-system-ui-controller:1.6.7")
Release version are available in Sonatyp's repository.
CompositionLocalProvider(
LocalMutableExKeyboardStateSourceOwner provides MutableExKeyboardStateSource()
) {
Scaffold(
modifier = Modifier
.removeFocusWhenKeyboardIsHidden()
) {
}
}
val keyboardState by mutableKeyboardStateSource.keyboardState()
DisposableEffect(showKeyboard) {
// Use keyboard state
onDispose {
}
}
// Remember a SystemUiController
val systemUiController = rememberExSystemUiController()
DisposableEffect(systemUiController) {
// Update all of the system bar colors to be transparent, and use
// dark icons if we're in light theme
systemUiController.setSystemBarsColor(
color = Color.Transparent,
)
// setStatusBarColor() and setNavigationBarColor() also exist
onDispose {}
}