mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-04-20 22:29:10 +00:00
make searchText non-saveable and add a comment
This commit is contained in:
parent
452770566c
commit
7a57f5a24f
1 changed files with 5 additions and 3 deletions
|
@ -33,7 +33,6 @@ import androidx.compose.runtime.LaunchedEffect
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
import androidx.compose.runtime.mutableStateOf
|
import androidx.compose.runtime.mutableStateOf
|
||||||
import androidx.compose.runtime.remember
|
import androidx.compose.runtime.remember
|
||||||
import androidx.compose.runtime.saveable.rememberSaveable
|
|
||||||
import androidx.compose.runtime.setValue
|
import androidx.compose.runtime.setValue
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.draw.rotate
|
import androidx.compose.ui.draw.rotate
|
||||||
|
@ -107,9 +106,12 @@ fun <T: Any?> SearchScreen(
|
||||||
menu: List<Pair<String, () -> Unit>>? = null,
|
menu: List<Pair<String, () -> Unit>>? = null,
|
||||||
content: @Composable (ColumnScope.() -> Unit)? = null,
|
content: @Composable (ColumnScope.() -> Unit)? = null,
|
||||||
) {
|
) {
|
||||||
var searchText by rememberSaveable(stateSaver = TextFieldValue.Saver) { mutableStateOf(TextFieldValue()) }
|
// searchText and showSearch should have the same remember or rememberSaveable
|
||||||
Column(Modifier.fillMaxSize()) {
|
// saveable survives orientation changes and switching between screens, but shows the
|
||||||
|
// keyboard in unexpected situations such as going back from another screen, which is rather annoying
|
||||||
|
var searchText by remember { mutableStateOf(TextFieldValue()) }
|
||||||
var showSearch by remember { mutableStateOf(false) }
|
var showSearch by remember { mutableStateOf(false) }
|
||||||
|
Column(Modifier.fillMaxSize()) {
|
||||||
|
|
||||||
fun setShowSearch(value: Boolean) {
|
fun setShowSearch(value: Boolean) {
|
||||||
showSearch = value
|
showSearch = value
|
||||||
|
|
Loading…
Add table
Reference in a new issue