mirror of
https://github.com/msfjarvis/compose-lobsters
synced 2025-08-14 22:17:03 +05:30
feat(common): add a clickable icon to SearchBar
This commit is contained in:
parent
63c3e26f5c
commit
255439e2b4
1 changed files with 9 additions and 0 deletions
|
@ -14,6 +14,10 @@ import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||||
import androidx.compose.foundation.text.KeyboardActions
|
import androidx.compose.foundation.text.KeyboardActions
|
||||||
import androidx.compose.foundation.text.KeyboardOptions
|
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.MaterialTheme
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.material3.TextField
|
import androidx.compose.material3.TextField
|
||||||
|
@ -43,6 +47,11 @@ fun SearchBar(
|
||||||
shape = RoundedCornerShape(topStart = 16.dp, topEnd = 16.dp),
|
shape = RoundedCornerShape(topStart = 16.dp, topEnd = 16.dp),
|
||||||
textStyle = MaterialTheme.typography.bodyLarge,
|
textStyle = MaterialTheme.typography.bodyLarge,
|
||||||
placeholder = { Text(text = "Search") },
|
placeholder = { Text(text = "Search") },
|
||||||
|
trailingIcon = {
|
||||||
|
IconButton(onClick = { onSearch(value) }) {
|
||||||
|
Icon(imageVector = Icons.Outlined.Search, contentDescription = "Search")
|
||||||
|
}
|
||||||
|
},
|
||||||
keyboardActions = KeyboardActions(onSearch = { onSearch(value) }),
|
keyboardActions = KeyboardActions(onSearch = { onSearch(value) }),
|
||||||
keyboardOptions =
|
keyboardOptions =
|
||||||
KeyboardOptions(
|
KeyboardOptions(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue