Hello! I'm hoping for an easy answer to my questio...
# multiplatform
d
Hello! I'm hoping for an easy answer to my question. Is
ModalBottomSheet
available in compose multiplatform (shared UI)? I'm not able to import with:
Copy code
import androidx.compose.material3.ModalBottomSheet
And my versions are:
Copy code
composeMultiplatform = { id = "org.jetbrains.compose", version.ref = "compose-multiplatform" } // 1.7.3
androidx-material3 = { module = "org.jetbrains.compose.material3:material3", version.ref = "material3" } // 1.3.1
According to the docs if I'm on Compose Multiplatform 1.7.3, it should use Jetpack Compose Material3 version 1.3.1. Maybe I have my imports wrong somehow? Thanks!
solved 2
b
We use plenty of
import androidx.compose.material3.ModalBottomSheet
on our project. we add our dependency through
implementation(compose.material3)
, though, which I understand is using the
compose
library configured by the
id("org.jetbrains.kotlin.plugin.compose")
plugin. You seem to be adding this to your own
libs.versions.toml
, which is probably not compatible with KMP.
1
This is more of a Compose issue, though, so I think you will find more helpful answers in #CJLTWPH7S
d
Aha! Swapped out
implementation(libs.androidx.material3)
for
implementation(compose.material3)
under
commonMain
and it found it! Thanks a bunch
very nice 1
s
@Drake Gebhart so you solved just adding implementation(compose.material3) in the sourceSets commonMain.dependencies, but what about the default material implementation? Do you remove it or use both? What command do you pass to download the new version of material3?
d
@Stefano Milani I do not have a default material implementation, and I still use material for icons in my app. To download the new version of material3 I'm just doing a gradle sync in Android Studio. For reference here is my commonMain import
Copy code
commonMain.dependencies {
            implementation(compose.runtime)
            implementation(compose.foundation)
            implementation(compose.ui)
            implementation(compose.components.resources)
            implementation(compose.components.uiToolingPreview)
            implementation(compose.material3)

            implementation(libs.androidx.lifecycle.viewmodel)
            implementation(libs.androidx.lifecycle.runtime.compose)
            implementation(libs.navigation.compose)
            implementation(libs.kotlinx.datetime)
            implementation(libs.lifecycle.viewmodel.compose)
            implementation(libs.kotlinx.serialization.json)

            // Settings
            implementation(libs.multiplatform.settings)

            // Network
            implementation(libs.ktorfit.lib)
            implementation(libs.ktorfit.converters.response)
            implementation(libs.ktorfit.converters.call)
            implementation(libs.ktorfit.converters.flow)
            implementation(libs.ktor.client.serialization)
            implementation(libs.ktor.client.content.negotiation)
            implementation(libs.ktor.serialization.kotlinx.json)
            implementation(libs.ktor.client.cio)
            implementation(libs.ktor.client.auth)
            implementation(libs.ktor.client.logging)
        }
And plugins
Copy code
plugins {
    alias(libs.plugins.kotlinMultiplatform)
    alias(libs.plugins.androidApplication)
    alias(libs.plugins.composeMultiplatform)
    alias(libs.plugins.composeCompiler)
    id("com.google.devtools.ksp") version "2.1.0-1.0.29"
    id("de.jensklingenberg.ktorfit") version "2.2.0"
    kotlin("plugin.serialization") version "2.1.0"
}