Clearing searchTerm when closing searchbar
This commit is contained in:
parent
a5a27c7781
commit
4e4b3944ba
|
@ -95,7 +95,10 @@ fun BottomBar(showMenuDrawer: Boolean = true) {
|
||||||
textStyle = TextStyle(color),
|
textStyle = TextStyle(color),
|
||||||
placeholder = { Text("Umsätze suchen ...", color = color.copy(ContentAlpha.medium), modifier = Modifier.height(48.dp)) },
|
placeholder = { Text("Umsätze suchen ...", color = color.copy(ContentAlpha.medium), modifier = Modifier.height(48.dp)) },
|
||||||
singleLine = true,
|
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 ->
|
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 (event.key == Key.Escape && event.type == KeyEventType.KeyUp) {
|
||||||
if (transactionsFilter.searchTerm.isBlank()) {
|
if (transactionsFilter.searchTerm.isBlank()) {
|
||||||
|
|
Loading…
Reference in New Issue