Android Compose extension.
- Keyboard show/hide extensions.
- Android System UI Controller
Use gradle - compose 1.7.0, compose compiler 1.5.15, kotlin 1.9.25
implementation("tech.thdev:extensions-compose-keyboard-state:1.7.0")
implementation("tech.thdev:extensions-compose-system-ui-controller:1.7.0")
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 {}
}