Search functionality - Jetpack Compose
In Jetpack Compose, there is no built-in Composable to perform a search. Instead, you need to create one using the TextField
composable.
// Example of SearchView build using TextField
TextField(
value = searchQuery,
onValueChange = { searchQuery = it },
modifier = Modifier
.fillMaxWidth()
.padding(8.dp),
placeholder = {
Text(text = "Search...")
},
singleLine = true,
colors = TextFieldDefaults.textFieldColors(
backgroundColor = Color.White,
focusedIndicatorColor = Color.Blue,
unfocusedIndicatorColor = Color.Gray
)
)