fix weird double window insets

This commit is contained in:
Helium314 2025-02-24 20:42:21 +01:00
parent a8bd9058e7
commit 761b56fdc3

View file

@ -113,8 +113,7 @@ fun <T: Any?> SearchScreen(
) { ) {
var searchText by rememberSaveable(stateSaver = TextFieldValue.Saver) { mutableStateOf(TextFieldValue()) } var searchText by rememberSaveable(stateSaver = TextFieldValue.Saver) { mutableStateOf(TextFieldValue()) }
Column(Modifier.fillMaxSize()) { Column(Modifier.fillMaxSize()) {
// todo: saving is good on orientation change, but bad on pressing back... var showSearch by remember { mutableStateOf(false) }
var showSearch by rememberSaveable { mutableStateOf(false) }
fun setShowSearch(value: Boolean) { fun setShowSearch(value: Boolean) {
showSearch = value showSearch = value
@ -182,12 +181,15 @@ fun <T: Any?> SearchScreen(
CompositionLocalProvider(LocalTextStyle provides MaterialTheme.typography.bodyLarge) { CompositionLocalProvider(LocalTextStyle provides MaterialTheme.typography.bodyLarge) {
if (searchText.text.isBlank() && content != null) { if (searchText.text.isBlank() && content != null) {
Column( Column(
Modifier // todo: how and where to best deal with insets?
.windowInsetsPadding( // here? manifest android:windowSoftInputMode="adjustResize"?
WindowInsets.safeDrawing.only( // other?
WindowInsetsSides.Horizontal + WindowInsetsSides.Bottom // Modifier
) // .windowInsetsPadding(
) // WindowInsets.safeDrawing.only(
// WindowInsetsSides.Horizontal + WindowInsetsSides.Bottom
// )
// )
) { ) {
content() content()
} }