Skip to content

Commit b7e914d

Browse files
committed
return if no query, and add alpha for leading icon
1 parent ddd7492 commit b7e914d

File tree

1 file changed

+5
-2
lines changed
  • app/src/main/java/com/fpf/smartscan/ui/screens/search

1 file changed

+5
-2
lines changed

app/src/main/java/com/fpf/smartscan/ui/screens/search/SearchBar.kt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,10 @@ fun SearchBar(
4141
modifier = Modifier.fillMaxWidth(),
4242
shape = RoundedCornerShape(8.dp),
4343
keyboardActions = KeyboardActions (
44-
onSearch = {onSearch(nSimilarResult, threshold)}
44+
onSearch = {
45+
if(query.isBlank()) return@KeyboardActions
46+
onSearch(nSimilarResult, threshold)
47+
}
4548
),
4649
keyboardOptions = KeyboardOptions.Default.copy(
4750
imeAction = ImeAction.Search
@@ -50,7 +53,7 @@ fun SearchBar(
5053
Icon(
5154
imageVector = Icons.Filled.Search,
5255
contentDescription = "Search",
53-
tint = MaterialTheme.colorScheme.onBackground,
56+
tint = MaterialTheme.colorScheme.onBackground.copy(alpha = if (enabled) 1f else 0.3f),
5457
)
5558
},
5659
trailingIcon = if (query.isNotBlank()) { {

0 commit comments

Comments
 (0)