Using now own snackbarHostState so that we can place StateHandler where we want

This commit is contained in:
dankito 2024-09-05 04:40:27 +02:00
parent 2315e4b84a
commit 568b6b8301
1 changed files with 5 additions and 3 deletions

View File

@ -46,6 +46,8 @@ fun App() {
val drawerState = DI.uiState.drawerState.collectAsState().value val drawerState = DI.uiState.drawerState.collectAsState().value
val snackbarHostState = remember { SnackbarHostState() }
val coroutineScope = rememberCoroutineScope() val coroutineScope = rememberCoroutineScope()
coroutineScope.launch { coroutineScope.launch {
@ -55,7 +57,7 @@ fun App() {
MaterialTheme(colors = colors, typography = typography) { MaterialTheme(colors = colors, typography = typography) {
Scaffold( Scaffold(
scaffoldState = rememberScaffoldState(drawerState), scaffoldState = rememberScaffoldState(drawerState, snackbarHostState),
bottomBar = { BottomBar() }, bottomBar = { BottomBar() },
backgroundColor = Colors.Zinc100, backgroundColor = Colors.Zinc100,
floatingActionButton = { floatingActionButton = {
@ -70,8 +72,6 @@ fun App() {
drawerContent = { SideMenuContent() }, drawerContent = { SideMenuContent() },
drawerBackgroundColor = Colors.DrawerContentBackground, drawerBackgroundColor = Colors.DrawerContentBackground,
snackbarHost = { snackbarHostState -> snackbarHost = { snackbarHostState ->
StateHandler(uiState, snackbarHostState)
SnackbarHost( SnackbarHost(
hostState = snackbarHostState hostState = snackbarHostState
) { data -> ) { data ->
@ -93,6 +93,8 @@ fun App() {
Column(Modifier.fillMaxSize().padding(scaffoldPadding), horizontalAlignment = Alignment.CenterHorizontally) { Column(Modifier.fillMaxSize().padding(scaffoldPadding), horizontalAlignment = Alignment.CenterHorizontally) {
TransactionsList(uiState, uiSettings) TransactionsList(uiState, uiSettings)
} }
StateHandler(uiState, snackbarHostState)
} }
} }
} }