KotlinLeaner
05/22/2023, 11:54 AMKotlinLeaner
05/22/2023, 11:55 AM@Preview(showBackground = true)
@Composable
fun PopupFilterItem() {
var textValue by remember { mutableStateOf("") }
val oldList by remember {
mutableStateOf((1..10).map { it.toString() })
}
val newSearchList by remember {
derivedStateOf { oldList.filter { it.contains(textValue) } }
}
Column(Modifier.fillMaxSize()) {
TextField(
value = textValue,
onValueChange = { textValue = it }
)
Box(Modifier.wrapContentSize()) {
Popup {
Column {
newSearchList.forEach { Text(text = it) }
}
}
}
}
}