From a532130fcb792a41bfc9d473d0d28f90e5c1eac6 Mon Sep 17 00:00:00 2001 From: dankito Date: Fri, 4 Oct 2024 09:06:00 +0200 Subject: [PATCH] On click on title also toggling drawer state --- .../net/codinux/banking/ui/appskeleton/BottomBar.kt | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) 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 50fb0a4..32a0371 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 @@ -40,12 +40,17 @@ fun BottomBar(showMenuDrawer: Boolean = true) { val coroutineScope = rememberCoroutineScope() + fun toggleDrawerState() { + coroutineScope.launch { + uiState.drawerState.value.toggle() + } + } + + BottomAppBar { if (showMenuDrawer) { IconButton( - onClick = { coroutineScope.launch { - uiState.drawerState.value.toggle() - } } + onClick = { toggleDrawerState() } ) { Icon(Icons.Filled.Menu, contentDescription = "Open Navigation Drawer with sidebar menu") } @@ -68,7 +73,7 @@ fun BottomBar(showMenuDrawer: Boolean = true) { selectedAccount.bank.displayName } - Text(title, color = color, maxLines = 1, overflow = TextOverflow.Ellipsis) + Text(title, color = color, maxLines = 1, overflow = TextOverflow.Ellipsis, modifier = Modifier.clickable { toggleDrawerState() }) } }