Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions compose/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ dependencies {
api(projects.core)
implementation(platform(libs.androidx.compose.bom))
implementation(libs.androidx.compose.ui)
implementation(libs.androidx.compose.foundation)
implementation(libs.hilt)
ksp(libs.hilt.compiler)
implementation(libs.kotlinx.collections.immutable)
Expand Down
2 changes: 1 addition & 1 deletion compose/src/main/java/com/naturecurly/deck/compose/Deck.kt
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ fun Deck(provider: DeckProvider<*>, content: @Composable DeckScope.() -> Unit) {
@Composable
private fun rememberDeckScope(containers: ImmutableMap<String, DeckComposeContainerUi<*, *>>) =
remember(containers) {
DeckScopeImpl(containers)
DeckScope(containers)
}

@Composable
Expand Down
17 changes: 14 additions & 3 deletions compose/src/main/java/com/naturecurly/deck/compose/DeckScope.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,32 @@
package com.naturecurly.deck.compose

import android.annotation.SuppressLint
import androidx.compose.foundation.lazy.LazyListScope
import androidx.compose.runtime.Composable
import androidx.compose.runtime.Immutable
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import com.naturecurly.deck.compose.log.DeckLog
import kotlinx.collections.immutable.ImmutableMap

@Immutable
abstract class DeckScope {
protected abstract val containerUis: Map<String, DeckComposeContainerUi<*, *>>

class DeckScope(private val containerUis: ImmutableMap<String, DeckComposeContainerUi<*, *>>) {
@SuppressLint("RememberReturnType")
@Composable
fun Stub(containerUiId: String, modifier: Modifier = Modifier) {
containerUis[containerUiId]?.Content(modifier) ?: remember(containerUiId) {
DeckLog.w("Not found containerId: $containerUiId")
}
}

fun LazyListScope.itemStub(
containerUiId: String,
modifier: Modifier = Modifier,
key: Any? = null,
contentType: Any? = null,
) {
item(key, contentType) {
Stub(containerUiId, modifier)
}
}
}

This file was deleted.

2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ androidx-activity-compose = { group = "androidx.activity", name = "activity-comp
androidx-compose-bom = { group = "androidx.compose", name = "compose-bom", version.ref = "composeBom" }
androidx-compose-runtime = { group = "androidx.compose.runtime", name = "runtime" }
androidx-compose-ui = { group = "androidx.compose.ui", name = "ui" }
androidx-ui = { group = "androidx.compose.ui", name = "ui" }
androidx-compose-foundation = { group = "androidx.compose.foundation", name = "foundation" }
androidx-ui-graphics = { group = "androidx.compose.ui", name = "ui-graphics" }
androidx-ui-tooling = { group = "androidx.compose.ui", name = "ui-tooling" }
androidx-ui-tooling-preview = { group = "androidx.compose.ui", name = "ui-tooling-preview" }
Expand Down
2 changes: 1 addition & 1 deletion sample/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ dependencies {
implementation(libs.androidx.lifecycle.viewmodel.compose)
implementation(libs.androidx.activity.compose)
implementation(platform(libs.androidx.compose.bom))
implementation(libs.androidx.ui)
implementation(libs.androidx.compose.ui)
implementation(libs.androidx.ui.graphics)
implementation(libs.androidx.ui.tooling.preview)
implementation(libs.androidx.material3)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ package com.naturecurly.deck.sample.feature1
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
Expand Down Expand Up @@ -56,6 +57,9 @@ private fun DeckScope.Content() {
)
Stub("FeatureOne")
Stub("FeatureTwo", modifier = Modifier.padding(top = 20.dp))
LazyColumn {
itemStub("FeatureOne")
}
}
}
}
Expand Down