File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
src/main/kotlin/composables Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,10 @@ import androidx.compose.material.Text
10
10
import androidx.compose.material.TextField
11
11
import androidx.compose.material.TextFieldDefaults
12
12
import androidx.compose.runtime.Composable
13
+ import androidx.compose.runtime.getValue
14
+ import androidx.compose.runtime.mutableStateOf
15
+ import androidx.compose.runtime.remember
16
+ import androidx.compose.runtime.setValue
13
17
import androidx.compose.ui.Modifier
14
18
import androidx.compose.ui.graphics.Color
15
19
import androidx.compose.ui.res.painterResource
@@ -26,10 +30,14 @@ fun FilterTextField(
26
30
onFilterChange : (String ) -> Unit
27
31
) {
28
32
val filterIcon = painterResource(icon.resource)
33
+ var localFilterText by remember(filterText) { mutableStateOf(filterText) }
29
34
30
35
TextField (
31
- value = filterText,
32
- onValueChange = onFilterChange,
36
+ value = localFilterText,
37
+ onValueChange = {
38
+ localFilterText = it
39
+ onFilterChange(it)
40
+ },
33
41
placeholder = { Text (label) },
34
42
singleLine = true ,
35
43
leadingIcon = { Icon (filterIcon, label) },
You can’t perform that action at this time.
0 commit comments