From 5dce465c3f4eb97ca2d689cd1101e1da487e7a66 Mon Sep 17 00:00:00 2001 From: Sebastian Neubauer Date: Fri, 6 Mar 2026 16:09:34 +0000 Subject: [PATCH 1/2] Make DashboardScope accept Flow instead of StateFlow --- .../flocon/plugins/dashboard/model/DashboardScope.kt | 5 +++-- .../flocon/plugins/dashboard/FloconDashboardDSL.kt | 8 ++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/FloconAndroid/flocon-base/src/commonMain/kotlin/io/github/openflocon/flocon/plugins/dashboard/model/DashboardScope.kt b/FloconAndroid/flocon-base/src/commonMain/kotlin/io/github/openflocon/flocon/plugins/dashboard/model/DashboardScope.kt index b5e1f4c3b..9c76f78eb 100644 --- a/FloconAndroid/flocon-base/src/commonMain/kotlin/io/github/openflocon/flocon/plugins/dashboard/model/DashboardScope.kt +++ b/FloconAndroid/flocon-base/src/commonMain/kotlin/io/github/openflocon/flocon/plugins/dashboard/model/DashboardScope.kt @@ -2,17 +2,18 @@ package io.github.openflocon.flocon.plugins.dashboard.model import io.github.openflocon.flocon.plugins.dashboard.builder.FormBuilder import io.github.openflocon.flocon.plugins.dashboard.builder.SectionBuilder +import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.StateFlow interface DashboardScope { - fun section(name: String, flow: StateFlow, content: SectionBuilder.(T) -> Unit) + fun section(name: String, flow: Flow, content: SectionBuilder.(T) -> Unit) fun section(name: String, content: SectionBuilder.() -> Unit) fun form( name: String, submitText: String = "Submit", onSubmitted: (Map) -> Unit, - flow: StateFlow, + flow: Flow, content: FormBuilder.(T) -> Unit ) diff --git a/FloconAndroid/flocon/src/commonMain/kotlin/io/github/openflocon/flocon/plugins/dashboard/FloconDashboardDSL.kt b/FloconAndroid/flocon/src/commonMain/kotlin/io/github/openflocon/flocon/plugins/dashboard/FloconDashboardDSL.kt index c866fa72b..db7ae8cb3 100644 --- a/FloconAndroid/flocon/src/commonMain/kotlin/io/github/openflocon/flocon/plugins/dashboard/FloconDashboardDSL.kt +++ b/FloconAndroid/flocon/src/commonMain/kotlin/io/github/openflocon/flocon/plugins/dashboard/FloconDashboardDSL.kt @@ -57,10 +57,10 @@ internal class DashboardScopeImpl : DashboardScope { * The section will be re-rendered whenever the [flow] emits a new value. * * @param name The name of the section. - * @param flow The [StateFlow] providing the data for the section. + * @param flow The [Flow] providing the data for the section. * @param content The builder to construct the section content based on the data. */ - override fun section(name: String, flow: StateFlow, content: SectionBuilder.(T) -> Unit) { + override fun section(name: String, flow: Flow, content: SectionBuilder.(T) -> Unit) { val sectionFlow = flow.map { item -> SectionBuilder(name) .apply { content(item) } @@ -90,14 +90,14 @@ internal class DashboardScopeImpl : DashboardScope { * @param name The name of the form. * @param submitText The text to display on the submit button. * @param onSubmitted The callback to be invoked when the form is submitted. - * @param flow The [StateFlow] providing the data for the form. + * @param flow The [Flow] providing the data for the form. * @param content The builder to construct the form content based on the data. */ override fun form( name: String, submitText: String, onSubmitted: (Map) -> Unit, - flow: StateFlow, + flow: Flow, content: FormBuilder.(T) -> Unit ) { val formFlow = flow.map { item -> From 87bc02885939dd20e6b0e3295299c08e6e1b3994 Mon Sep 17 00:00:00 2001 From: Sebastian Neubauer Date: Sat, 7 Mar 2026 08:35:34 +0000 Subject: [PATCH 2/2] Remove imports --- .../openflocon/flocon/plugins/dashboard/model/DashboardScope.kt | 1 - .../openflocon/flocon/plugins/dashboard/FloconDashboardDSL.kt | 1 - 2 files changed, 2 deletions(-) diff --git a/FloconAndroid/flocon-base/src/commonMain/kotlin/io/github/openflocon/flocon/plugins/dashboard/model/DashboardScope.kt b/FloconAndroid/flocon-base/src/commonMain/kotlin/io/github/openflocon/flocon/plugins/dashboard/model/DashboardScope.kt index 9c76f78eb..3089b07f8 100644 --- a/FloconAndroid/flocon-base/src/commonMain/kotlin/io/github/openflocon/flocon/plugins/dashboard/model/DashboardScope.kt +++ b/FloconAndroid/flocon-base/src/commonMain/kotlin/io/github/openflocon/flocon/plugins/dashboard/model/DashboardScope.kt @@ -3,7 +3,6 @@ package io.github.openflocon.flocon.plugins.dashboard.model import io.github.openflocon.flocon.plugins.dashboard.builder.FormBuilder import io.github.openflocon.flocon.plugins.dashboard.builder.SectionBuilder import kotlinx.coroutines.flow.Flow -import kotlinx.coroutines.flow.StateFlow interface DashboardScope { fun section(name: String, flow: Flow, content: SectionBuilder.(T) -> Unit) diff --git a/FloconAndroid/flocon/src/commonMain/kotlin/io/github/openflocon/flocon/plugins/dashboard/FloconDashboardDSL.kt b/FloconAndroid/flocon/src/commonMain/kotlin/io/github/openflocon/flocon/plugins/dashboard/FloconDashboardDSL.kt index db7ae8cb3..5560f448d 100644 --- a/FloconAndroid/flocon/src/commonMain/kotlin/io/github/openflocon/flocon/plugins/dashboard/FloconDashboardDSL.kt +++ b/FloconAndroid/flocon/src/commonMain/kotlin/io/github/openflocon/flocon/plugins/dashboard/FloconDashboardDSL.kt @@ -10,7 +10,6 @@ import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Job import kotlinx.coroutines.SupervisorJob import kotlinx.coroutines.flow.Flow -import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.combine import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.flow.map