mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-06-11 00:49:33 +00:00
Fix settings search insets by moving top & horizontal insets to the top of the setting screen. (#1510)
This commit is contained in:
parent
54c2c364a0
commit
bedb9d1517
3 changed files with 81 additions and 92 deletions
|
@ -64,8 +64,7 @@ fun SearchSettingsScreen(
|
||||||
if (content != null) content()
|
if (content != null) content()
|
||||||
else {
|
else {
|
||||||
Scaffold(
|
Scaffold(
|
||||||
contentWindowInsets = WindowInsets.safeDrawing
|
contentWindowInsets = WindowInsets.safeDrawing.only(WindowInsetsSides.Bottom)
|
||||||
.only(WindowInsetsSides.Horizontal + WindowInsetsSides.Bottom)
|
|
||||||
) { innerPadding ->
|
) { innerPadding ->
|
||||||
Column(
|
Column(
|
||||||
Modifier.verticalScroll(rememberScrollState()).then(Modifier.padding(innerPadding))
|
Modifier.verticalScroll(rememberScrollState()).then(Modifier.padding(innerPadding))
|
||||||
|
@ -123,7 +122,9 @@ fun <T: Any?> SearchScreen(
|
||||||
// keyboard in unexpected situations such as going back from another screen, which is rather annoying
|
// keyboard in unexpected situations such as going back from another screen, which is rather annoying
|
||||||
var searchText by remember { mutableStateOf(TextFieldValue()) }
|
var searchText by remember { mutableStateOf(TextFieldValue()) }
|
||||||
var showSearch by remember { mutableStateOf(false) }
|
var showSearch by remember { mutableStateOf(false) }
|
||||||
Column(Modifier.fillMaxSize()) {
|
Scaffold(contentWindowInsets = WindowInsets.safeDrawing.only(WindowInsetsSides.Horizontal + WindowInsetsSides.Top))
|
||||||
|
{ innerPadding ->
|
||||||
|
Column(Modifier.fillMaxSize().padding(innerPadding)) {
|
||||||
|
|
||||||
fun setShowSearch(value: Boolean) {
|
fun setShowSearch(value: Boolean) {
|
||||||
showSearch = value
|
showSearch = value
|
||||||
|
@ -139,7 +140,7 @@ fun <T: Any?> SearchScreen(
|
||||||
Column {
|
Column {
|
||||||
TopAppBar(
|
TopAppBar(
|
||||||
title = title,
|
title = title,
|
||||||
windowInsets = TopAppBarDefaults.windowInsets,
|
windowInsets = WindowInsets(0),
|
||||||
navigationIcon = {
|
navigationIcon = {
|
||||||
IconButton(onClick = {
|
IconButton(onClick = {
|
||||||
if (showSearch) setShowSearch(false)
|
if (showSearch) setShowSearch(false)
|
||||||
|
@ -192,24 +193,13 @@ 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 {
|
||||||
// todo: how and where to best deal with insets?
|
|
||||||
// here? manifest android:windowSoftInputMode="adjustResize"?
|
|
||||||
// other?
|
|
||||||
// Modifier
|
|
||||||
// .windowInsetsPadding(
|
|
||||||
// WindowInsets.safeDrawing.only(
|
|
||||||
// WindowInsetsSides.Horizontal + WindowInsetsSides.Bottom
|
|
||||||
// )
|
|
||||||
// )
|
|
||||||
) {
|
|
||||||
content()
|
content()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
val items = filteredItems(searchText.text)
|
val items = filteredItems(searchText.text)
|
||||||
Scaffold(
|
Scaffold(
|
||||||
contentWindowInsets = WindowInsets.safeDrawing
|
contentWindowInsets = WindowInsets.safeDrawing.only(WindowInsetsSides.Bottom)
|
||||||
.only(WindowInsetsSides.Horizontal + WindowInsetsSides.Bottom)
|
|
||||||
) { innerPadding ->
|
) { innerPadding ->
|
||||||
LazyColumn(contentPadding = innerPadding) {
|
LazyColumn(contentPadding = innerPadding) {
|
||||||
items(items) {
|
items(items) {
|
||||||
|
@ -221,6 +211,7 @@ fun <T: Any?> SearchScreen(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// from StreetComplete
|
// from StreetComplete
|
||||||
/** Expandable text field that can be dismissed and requests focus when it is expanded */
|
/** Expandable text field that can be dismissed and requests focus when it is expanded */
|
||||||
|
|
|
@ -48,9 +48,7 @@ fun MainSettingsScreen(
|
||||||
settings = emptyList(),
|
settings = emptyList(),
|
||||||
) {
|
) {
|
||||||
val enabledSubtypes = SubtypeSettings.getEnabledSubtypes(true)
|
val enabledSubtypes = SubtypeSettings.getEnabledSubtypes(true)
|
||||||
Scaffold(
|
Scaffold(contentWindowInsets = WindowInsets.safeDrawing.only(WindowInsetsSides.Bottom)) { innerPadding ->
|
||||||
contentWindowInsets = WindowInsets.safeDrawing.only(WindowInsetsSides.Horizontal + WindowInsetsSides.Bottom)
|
|
||||||
) { innerPadding ->
|
|
||||||
Column(
|
Column(
|
||||||
Modifier.verticalScroll(rememberScrollState()).then(Modifier.padding(innerPadding))
|
Modifier.verticalScroll(rememberScrollState()).then(Modifier.padding(innerPadding))
|
||||||
) {
|
) {
|
||||||
|
|
|
@ -146,7 +146,7 @@ fun SubtypeScreen(
|
||||||
filteredItems = { emptyList<String>() }
|
filteredItems = { emptyList<String>() }
|
||||||
) {
|
) {
|
||||||
Scaffold(
|
Scaffold(
|
||||||
contentWindowInsets = WindowInsets.safeDrawing.only(WindowInsetsSides.Horizontal + WindowInsetsSides.Bottom)
|
contentWindowInsets = WindowInsets.safeDrawing.only(WindowInsetsSides.Bottom)
|
||||||
) { innerPadding ->
|
) { innerPadding ->
|
||||||
Column(
|
Column(
|
||||||
modifier = Modifier.verticalScroll(scrollState).padding(horizontal = 12.dp)
|
modifier = Modifier.verticalScroll(scrollState).padding(horizontal = 12.dp)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue