mirror of
https://github.com/mihonapp/mihon.git
synced 2025-11-15 21:47:28 +01:00
Use TextFieldState in BasicTextField where applicable (#1201)
Co-authored-by: p
This commit is contained in:
@@ -9,6 +9,7 @@ import androidx.compose.foundation.layout.WindowInsets
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.systemBars
|
||||
import androidx.compose.foundation.layout.windowInsetsPadding
|
||||
import androidx.compose.foundation.text.input.rememberTextFieldState
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.Delete
|
||||
import androidx.compose.material3.ButtonDefaults
|
||||
@@ -28,7 +29,6 @@ import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.text.input.TextFieldValue
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import cafe.adriel.voyager.core.model.ScreenModel
|
||||
import cafe.adriel.voyager.core.model.StateScreenModel
|
||||
@@ -666,11 +666,10 @@ data class TrackerSearchScreen(
|
||||
|
||||
val state by screenModel.state.collectAsState()
|
||||
|
||||
var textFieldValue by remember { mutableStateOf(TextFieldValue(initialQuery)) }
|
||||
val textFieldState = rememberTextFieldState(initialQuery)
|
||||
TrackerSearch(
|
||||
query = textFieldValue,
|
||||
onQueryChange = { textFieldValue = it },
|
||||
onDispatchQuery = { screenModel.trackingSearch(textFieldValue.text) },
|
||||
state = textFieldState,
|
||||
onDispatchQuery = { screenModel.trackingSearch(textFieldState.text.toString()) },
|
||||
queryResult = state.queryResult,
|
||||
selected = state.selected,
|
||||
onSelectedChange = screenModel::updateSelection,
|
||||
|
||||
Reference in New Issue
Block a user