From 4e4b3944bae9ceb754f857d7ead1281a4796e12e Mon Sep 17 00:00:00 2001 From: dankito Date: Fri, 6 Sep 2024 17:34:22 +0200 Subject: [PATCH] Clearing searchTerm when closing searchbar --- .../kotlin/net/codinux/banking/ui/appskeleton/BottomBar.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/appskeleton/BottomBar.kt b/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/appskeleton/BottomBar.kt index 84dc5b7..db37c45 100644 --- a/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/appskeleton/BottomBar.kt +++ b/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/appskeleton/BottomBar.kt @@ -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()) {