From dd95a66acd57b9a8f4855f326923e3fe8ebe09e0 Mon Sep 17 00:00:00 2001 From: dankito Date: Thu, 5 Sep 2024 05:30:51 +0200 Subject: [PATCH] Extracted DesktopLayout() --- .../kotlin/net/codinux/banking/ui/App.kt | 20 ++--------- .../banking/ui/appskeleton/DesktopLayout.kt | 35 +++++++++++++++++++ 2 files changed, 37 insertions(+), 18 deletions(-) create mode 100644 composeApp/src/commonMain/kotlin/net/codinux/banking/ui/appskeleton/DesktopLayout.kt 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 c1a4d2b..62bbd96 100644 --- a/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/App.kt +++ b/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/App.kt @@ -12,9 +12,7 @@ import androidx.compose.ui.text.TextStyle import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import kotlinx.coroutines.launch -import net.codinux.banking.ui.appskeleton.AppContent -import net.codinux.banking.ui.appskeleton.BottomBar -import net.codinux.banking.ui.appskeleton.SideMenuContent +import net.codinux.banking.ui.appskeleton.* import net.codinux.banking.ui.config.Colors import net.codinux.banking.ui.config.DI import net.codinux.log.LoggerFactory @@ -97,21 +95,7 @@ fun App() { if (isMobile) { AppContent(scaffoldPadding, uiState, uiSettings, snackbarHostState, isMobile) } else { - Row(Modifier.fillMaxSize()) { - Column(Modifier.width(desktopDrawerWidth)) { - SideMenuContent() - } - - Column(Modifier.fillMaxSize().weight(1f).padding(start = 6.dp)) { - Row(Modifier.fillMaxWidth().weight(1f)) { - AppContent(scaffoldPadding, uiState, uiSettings, snackbarHostState, isMobile) - } - - Row(Modifier.fillMaxWidth()) { - BottomBar(false) - } - } - } + DesktopLayout(scaffoldPadding, uiState, uiSettings, snackbarHostState, desktopDrawerWidth) } } } diff --git a/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/appskeleton/DesktopLayout.kt b/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/appskeleton/DesktopLayout.kt new file mode 100644 index 0000000..0927e31 --- /dev/null +++ b/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/appskeleton/DesktopLayout.kt @@ -0,0 +1,35 @@ +package net.codinux.banking.ui.appskeleton + +import androidx.compose.foundation.layout.* +import androidx.compose.material.SnackbarHostState +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.compose.ui.unit.Dp +import androidx.compose.ui.unit.dp +import net.codinux.banking.ui.settings.UiSettings +import net.codinux.banking.ui.state.UiState + +@Composable +fun DesktopLayout( + scaffoldPadding: PaddingValues, + uiState: UiState, + uiSettings: UiSettings, + snackbarHostState: SnackbarHostState, + desktopDrawerWidth: Dp +) { + Row(Modifier.fillMaxSize()) { + Column(Modifier.width(desktopDrawerWidth)) { + SideMenuContent() + } + + Column(Modifier.fillMaxSize().weight(1f).padding(start = 6.dp)) { + Row(Modifier.fillMaxWidth().weight(1f)) { + AppContent(scaffoldPadding, uiState, uiSettings, snackbarHostState, false) + } + + Row(Modifier.fillMaxWidth()) { + BottomBar(false) + } + } + } +} \ No newline at end of file