From 568b6b83010a4279b4d49a64c38e11def5096962 Mon Sep 17 00:00:00 2001 From: dankito Date: Thu, 5 Sep 2024 04:40:27 +0200 Subject: [PATCH] Using now own snackbarHostState so that we can place StateHandler where we want --- .../src/commonMain/kotlin/net/codinux/banking/ui/App.kt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/App.kt b/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/App.kt index 55458b0..5826e26 100644 --- a/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/App.kt +++ b/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/App.kt @@ -46,6 +46,8 @@ fun App() { val drawerState = DI.uiState.drawerState.collectAsState().value + val snackbarHostState = remember { SnackbarHostState() } + val coroutineScope = rememberCoroutineScope() coroutineScope.launch { @@ -55,7 +57,7 @@ fun App() { MaterialTheme(colors = colors, typography = typography) { Scaffold( - scaffoldState = rememberScaffoldState(drawerState), + scaffoldState = rememberScaffoldState(drawerState, snackbarHostState), bottomBar = { BottomBar() }, backgroundColor = Colors.Zinc100, floatingActionButton = { @@ -70,8 +72,6 @@ fun App() { drawerContent = { SideMenuContent() }, drawerBackgroundColor = Colors.DrawerContentBackground, snackbarHost = { snackbarHostState -> - StateHandler(uiState, snackbarHostState) - SnackbarHost( hostState = snackbarHostState ) { data -> @@ -93,6 +93,8 @@ fun App() { Column(Modifier.fillMaxSize().padding(scaffoldPadding), horizontalAlignment = Alignment.CenterHorizontally) { TransactionsList(uiState, uiSettings) } + + StateHandler(uiState, snackbarHostState) } } } \ No newline at end of file