feat(common): add a clickable icon to SearchBar

This commit is contained in:
Harsh Shandilya 2023-07-18 23:16:57 +05:30
parent 63c3e26f5c
commit 255439e2b4

View file

@ -14,6 +14,10 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.text.KeyboardActions
import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.outlined.Search
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.material3.TextField
@ -43,6 +47,11 @@ fun SearchBar(
shape = RoundedCornerShape(topStart = 16.dp, topEnd = 16.dp),
textStyle = MaterialTheme.typography.bodyLarge,
placeholder = { Text(text = "Search") },
trailingIcon = {
IconButton(onClick = { onSearch(value) }) {
Icon(imageVector = Icons.Outlined.Search, contentDescription = "Search")
}
},
keyboardActions = KeyboardActions(onSearch = { onSearch(value) }),
keyboardOptions =
KeyboardOptions(