Skip to content

Commit

Permalink
Merge pull request #103 from joreilly/cmp_1_7_0_alpha03
Browse files Browse the repository at this point in the history
using Material3 Adaptive libraries
  • Loading branch information
joreilly authored Aug 27, 2024
2 parents 2300c47 + 8d30711 commit 05b8d04
Show file tree
Hide file tree
Showing 4 changed files with 234 additions and 392 deletions.
9 changes: 8 additions & 1 deletion composeApp/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ kotlin {
implementation(libs.koalaplot)
implementation(libs.treemap.chart)
implementation(libs.treemap.chart.compose)
api(libs.compose.window.size)
api(libs.compose.adaptive)
api(libs.compose.adaptive.layout)
}

jsMain.dependencies {
Expand All @@ -95,6 +96,8 @@ kotlin {
implementation(libs.koin.android)
implementation(libs.kstore.file)
implementation(libs.ktor.client.android)
// workaround for https://youtrack.jetbrains.com/issue/CMP-5959/Invalid-redirect-in-window-core#focus=Comments-27-10365630.0-0
implementation("androidx.window:window-core:1.3.0")
}

desktopMain.dependencies {
Expand Down Expand Up @@ -180,3 +183,7 @@ compose.experimental {
kotlin.sourceSets.all {
languageSettings.optIn("kotlin.experimental.ExperimentalObjCName")
}

configurations.configureEach {
exclude("androidx.window.core", "window-core")
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.SearchBar
import androidx.compose.material3.Text
import androidx.compose.material3.VerticalDivider
import androidx.compose.material3.windowsizeclass.ExperimentalMaterial3WindowSizeClassApi
import androidx.compose.material3.windowsizeclass.WindowWidthSizeClass
import androidx.compose.material3.windowsizeclass.calculateWindowSizeClass
import androidx.compose.material3.adaptive.currentWindowAdaptiveInfo
import androidx.compose.runtime.Composable
import androidx.compose.runtime.MutableState
import androidx.compose.runtime.collectAsState
Expand All @@ -48,6 +46,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalSoftwareKeyboardController
import androidx.compose.ui.unit.dp
import androidx.window.core.layout.WindowWidthSizeClass
import cafe.adriel.voyager.core.screen.Screen
import dev.johnoreilly.climatetrace.remote.Country
import dev.johnoreilly.climatetrace.ui.utils.PanelState
Expand Down Expand Up @@ -82,10 +81,9 @@ class ClimateTraceScreen: Screen {
}
}

@OptIn(ExperimentalMaterial3WindowSizeClassApi::class)
@Composable
fun CountryScreenSuccess(countryList: List<Country>) {
val windowSizeClass = calculateWindowSizeClass()
val windowAdaptiveInfo = currentWindowAdaptiveInfo() // calculateWindowSizeClass()
val countryDetailsViewModel = koinInject<CountryDetailsViewModel>()
val countryDetailsViewState by countryDetailsViewModel.viewState.collectAsState()
var selectedCountry by remember { mutableStateOf<Country?>(null) }
Expand All @@ -103,7 +101,8 @@ fun CountryScreenSuccess(countryList: List<Country>) {


Row(Modifier.fillMaxSize()) {
if (windowSizeClass.widthSizeClass == WindowWidthSizeClass.Compact) {
val windowSizeClass = windowAdaptiveInfo.windowSizeClass
if (windowSizeClass.windowWidthSizeClass == WindowWidthSizeClass.COMPACT) {
Column(Modifier.fillMaxWidth()) {
Box(
Modifier.height(250.dp).fillMaxWidth().background(color = Color.LightGray)
Expand Down
23 changes: 12 additions & 11 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
[versions]
kotlin = "2.0.0"
ksp = "2.0.0-1.0.22"
kotlinx-coroutines = "1.8.1"
kotlin = "2.0.20"
ksp = "2.0.20-1.0.24"
kotlinx-coroutines = "1.9.0-RC"


agp = "8.5.0"
agp = "8.5.2"
android-compileSdk = "34"
android-minSdk = "24"
android-targetSdk = "34"
androidx-activityCompose = "1.9.0"
compose = "1.6.8"
compose-plugin = "1.6.11"
composeWindowSize = "0.5.0"
androidx-activityCompose = "1.9.1"
compose = "1.7.0-beta06"
compose-plugin = "1.7.0-alpha03"
composeAdaptiveLayout = "1.0.0-alpha01"
harawata-appdirs = "1.2.2"
koalaplot = "0.5.3"
koin = "3.6.0-Beta4"
koin-android-compose = "3.6.0-Beta4"
koin-compose-multiplatform = "1.2.0-Beta4"
kmpNativeCoroutines = "1.0.0-ALPHA-31"
kmpObservableViewModel = "1.0.0-BETA-3"
kmpNativeCoroutines = "1.0.0-ALPHA-34"
kmpObservableViewModel = "1.0.0-BETA-4"
kstore = "0.8.0"
ktor = "3.0.0-beta-2"
treemapChart = "0.1.1"
Expand All @@ -32,7 +32,8 @@ androidx-activity-compose = { module = "androidx.activity:activity-compose", ver

compose-ui-tooling = { module = "androidx.compose.ui:ui-tooling", version.ref = "compose" }
compose-ui-tooling-preview = { module = "androidx.compose.ui:ui-tooling-preview", version.ref = "compose" }
compose-window-size = { module = "dev.chrisbanes.material3:material3-window-size-class-multiplatform", version.ref = "composeWindowSize" }
compose-adaptive = { module = "org.jetbrains.compose.material3.adaptive:adaptive", version.ref = "composeAdaptiveLayout" }
compose-adaptive-layout = { module = "org.jetbrains.compose.material3.adaptive:adaptive-layout", version.ref = "composeAdaptiveLayout" }

koin-android = { module = "io.insert-koin:koin-android", version.ref = "koin" }
koin-compose = { module = "io.insert-koin:koin-compose", version.ref = "koin-compose-multiplatform" }
Expand Down
Loading

0 comments on commit 05b8d04

Please sign in to comment.