Clearing searchTerm when closing searchbar

This commit is contained in:
dankito 2024-09-06 17:34:22 +02:00
parent a5a27c7781
commit 4e4b3944ba
1 changed files with 4 additions and 1 deletions

View File

@ -95,7 +95,10 @@ fun BottomBar(showMenuDrawer: Boolean = true) {
textStyle = TextStyle(color),
placeholder = { Text("Umsätze suchen ...", color = color.copy(ContentAlpha.medium), modifier = Modifier.height(48.dp)) },
singleLine = true,
trailingIcon = { Icon(Icons.Filled.Close, contentDescription = "Close search bar", Modifier.clickable { showSearchbar = false }, color) },
trailingIcon = { Icon(Icons.Filled.Close, contentDescription = "Close search bar", tint = color, modifier = Modifier.clickable {
showSearchbar = false
transactionsFilter.updateSearchTerm("")
}) },
modifier = Modifier.focusRequester(searchFieldFocus).widthIn(150.dp, 250.dp).padding(vertical = 4.dp).onKeyEvent { event ->
if (event.key == Key.Escape && event.type == KeyEventType.KeyUp) {
if (transactionsFilter.searchTerm.isBlank()) {