From c886ea7cd9bae9eafa81dc0235340bd8aacca2c6 Mon Sep 17 00:00:00 2001 From: Raphael TEYSSANDIER Date: Mon, 16 Feb 2026 21:12:27 +0100 Subject: [PATCH 1/3] feat: Add BigDialog scene --- .../openflocon/flocondesktop/app/AppScreen.kt | 2 + .../navigation/scene/BigDialogScene.kt | 121 ++++++++++++++++++ 2 files changed, 123 insertions(+) create mode 100644 FloconDesktop/navigation/src/commonMain/kotlin/io/github/openflocon/navigation/scene/BigDialogScene.kt diff --git a/FloconDesktop/composeApp/src/commonMain/kotlin/io/github/openflocon/flocondesktop/app/AppScreen.kt b/FloconDesktop/composeApp/src/commonMain/kotlin/io/github/openflocon/flocondesktop/app/AppScreen.kt index 413b9a1a6..5b4e5cf3a 100644 --- a/FloconDesktop/composeApp/src/commonMain/kotlin/io/github/openflocon/flocondesktop/app/AppScreen.kt +++ b/FloconDesktop/composeApp/src/commonMain/kotlin/io/github/openflocon/flocondesktop/app/AppScreen.kt @@ -26,6 +26,7 @@ import io.github.openflocon.flocondesktop.features.table.tableRoutes import io.github.openflocon.library.designsystem.FloconTheme import io.github.openflocon.navigation.FloconNavigation import io.github.openflocon.navigation.MainFloconNavigationState +import io.github.openflocon.navigation.scene.BigDialogSceneStrategy import io.github.openflocon.navigation.scene.DialogSceneStrategy import io.github.openflocon.navigation.scene.PanelSceneStrategy import io.github.openflocon.navigation.scene.WindowSceneStrategy @@ -58,6 +59,7 @@ private fun Content( sceneStrategy = PanelSceneStrategy() .then(WindowSceneStrategy()) .then(DialogSceneStrategy()) + .then(BigDialogSceneStrategy()) .then( MenuSceneStrategy( menuContent = { diff --git a/FloconDesktop/navigation/src/commonMain/kotlin/io/github/openflocon/navigation/scene/BigDialogScene.kt b/FloconDesktop/navigation/src/commonMain/kotlin/io/github/openflocon/navigation/scene/BigDialogScene.kt new file mode 100644 index 000000000..8d1a3c46a --- /dev/null +++ b/FloconDesktop/navigation/src/commonMain/kotlin/io/github/openflocon/navigation/scene/BigDialogScene.kt @@ -0,0 +1,121 @@ +@file:OptIn(ExperimentalMaterial3Api::class) + +package io.github.openflocon.navigation.scene + +import androidx.compose.foundation.background +import androidx.compose.foundation.clickable +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.filled.Close +import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.material3.Text +import androidx.compose.material3.TopAppBar +import androidx.compose.material3.TopAppBarDefaults +import androidx.compose.runtime.Composable +import androidx.compose.runtime.Immutable +import androidx.compose.ui.Modifier +import androidx.compose.ui.draw.clip +import androidx.compose.ui.draw.dropShadow +import androidx.compose.ui.graphics.shadow.Shadow +import androidx.compose.ui.unit.dp +import androidx.navigation3.runtime.NavEntry +import androidx.navigation3.scene.OverlayScene +import androidx.navigation3.scene.Scene +import androidx.navigation3.scene.SceneStrategy +import androidx.navigation3.scene.SceneStrategyScope +import io.github.openflocon.library.designsystem.FloconTheme +import io.github.openflocon.library.designsystem.components.FloconIcon +import io.github.openflocon.library.designsystem.components.FloconIconButton +import io.github.openflocon.library.designsystem.components.FloconScaffold +import io.github.openflocon.navigation.FloconRoute + +@Immutable +private data class BigDialogScene( + private val entry: NavEntry, + override val previousEntries: List>, + override val overlaidEntries: List>, + private val onBack: () -> Unit, +) : OverlayScene { + override val key: Any = BigDialogSceneStrategy.BIG_DIALOG + override val entries: List> = listOf(entry) + override val content: @Composable (() -> Unit) = { + FloconScaffold( + topBar = { + TopAppBar( + title = { + Text("Title") + }, + actions = { + FloconIconButton( + onClick = onBack + ) { + FloconIcon( + imageVector = Icons.Default.Close + ) + } + }, + colors = TopAppBarDefaults.topAppBarColors( + containerColor = FloconTheme.colorPalette.primary, + titleContentColor = FloconTheme.colorPalette.onPrimary, + actionIconContentColor = FloconTheme.colorPalette.onPrimary + ) + ) + }, + modifier = Modifier + .fillMaxSize() + .background(color = FloconTheme.colorPalette.primary.copy(alpha = 0.5f)) + .clickable( + onClick = onBack, + indication = null, + interactionSource = null + ) + .padding(64.dp) + .dropShadow( + shape = RoundedCornerShape(12.dp), + shadow = Shadow( + radius = 4.dp, + color = FloconTheme.colorPalette.onAccent + ) + ) + .clip(RoundedCornerShape(12.dp)) + .background(FloconTheme.colorPalette.primary) + .padding(16.dp) + ) { + Box( + modifier = Modifier + .fillMaxSize() + .padding(it) + ) { + entry.Content() + } + } + } +} + +class BigDialogSceneStrategy : SceneStrategy { + + override fun SceneStrategyScope.calculateScene( + entries: List> + ): Scene? { + val lastEntry = entries.lastOrNull() + val dialogProperties = lastEntry?.metadata?.get(BIG_DIALOG) as? Boolean + return dialogProperties?.let { properties -> + BigDialogScene( + entry = lastEntry, + previousEntries = entries.dropLast(1), + overlaidEntries = entries.dropLast(1), + onBack = onBack, + ) + } + } + + companion object { + const val BIG_DIALOG = "BIG_DIALOG" + + fun bigDialog(): Map = mapOf(BIG_DIALOG to true) + } + +} From 9f6c5276b358333cf21d8f90ebd0bb6fbfee0881 Mon Sep 17 00:00:00 2001 From: Raphael TEYSSANDIER Date: Wed, 4 Mar 2026 14:31:25 +0100 Subject: [PATCH 2/3] fix: Hardcoded title --- .../openflocon/navigation/scene/BigDialogScene.kt | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/FloconDesktop/navigation/src/commonMain/kotlin/io/github/openflocon/navigation/scene/BigDialogScene.kt b/FloconDesktop/navigation/src/commonMain/kotlin/io/github/openflocon/navigation/scene/BigDialogScene.kt index 8d1a3c46a..9ee7abb88 100644 --- a/FloconDesktop/navigation/src/commonMain/kotlin/io/github/openflocon/navigation/scene/BigDialogScene.kt +++ b/FloconDesktop/navigation/src/commonMain/kotlin/io/github/openflocon/navigation/scene/BigDialogScene.kt @@ -35,6 +35,7 @@ import io.github.openflocon.navigation.FloconRoute @Immutable private data class BigDialogScene( private val entry: NavEntry, + private val properties: BigDialogProperties, override val previousEntries: List>, override val overlaidEntries: List>, private val onBack: () -> Unit, @@ -46,7 +47,7 @@ private data class BigDialogScene( topBar = { TopAppBar( title = { - Text("Title") + Text(properties.title) }, actions = { FloconIconButton( @@ -95,16 +96,21 @@ private data class BigDialogScene( } } +data class BigDialogProperties( + val title: String +) + class BigDialogSceneStrategy : SceneStrategy { override fun SceneStrategyScope.calculateScene( entries: List> ): Scene? { val lastEntry = entries.lastOrNull() - val dialogProperties = lastEntry?.metadata?.get(BIG_DIALOG) as? Boolean + val dialogProperties = lastEntry?.metadata?.get(BIG_DIALOG) as? BigDialogProperties return dialogProperties?.let { properties -> BigDialogScene( entry = lastEntry, + properties = properties, previousEntries = entries.dropLast(1), overlaidEntries = entries.dropLast(1), onBack = onBack, @@ -115,7 +121,7 @@ class BigDialogSceneStrategy : SceneStrategy { companion object { const val BIG_DIALOG = "BIG_DIALOG" - fun bigDialog(): Map = mapOf(BIG_DIALOG to true) + fun bigDialog(properties: BigDialogProperties): Map = mapOf(BIG_DIALOG to properties) } } From 5f550fb341207e8981e3c2b4579b5b3eb432b200 Mon Sep 17 00:00:00 2001 From: Raphael TEYSSANDIER Date: Wed, 4 Mar 2026 14:33:22 +0100 Subject: [PATCH 3/3] fix: Background --- .../io/github/openflocon/navigation/scene/BigDialogScene.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FloconDesktop/navigation/src/commonMain/kotlin/io/github/openflocon/navigation/scene/BigDialogScene.kt b/FloconDesktop/navigation/src/commonMain/kotlin/io/github/openflocon/navigation/scene/BigDialogScene.kt index 9ee7abb88..26b71f137 100644 --- a/FloconDesktop/navigation/src/commonMain/kotlin/io/github/openflocon/navigation/scene/BigDialogScene.kt +++ b/FloconDesktop/navigation/src/commonMain/kotlin/io/github/openflocon/navigation/scene/BigDialogScene.kt @@ -65,9 +65,9 @@ private data class BigDialogScene( ) ) }, + containerColor = FloconTheme.colorPalette.primary.copy(alpha = 0.5f), modifier = Modifier .fillMaxSize() - .background(color = FloconTheme.colorPalette.primary.copy(alpha = 0.5f)) .clickable( onClick = onBack, indication = null,