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..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 @@ -2,17 +2,17 @@ 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.StateFlow +import kotlinx.coroutines.flow.Flow 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..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 @@ -57,10 +56,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 +89,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 ->