When creating a Compose Multiplatform Project and ...
# compose
v
When creating a Compose Multiplatform Project and using Material 3 Which dependencies, do i need to add,
compose.material3
only, or
compose.runtime
,
compose.foundation
etc etc too
j
I think if I remember correct, those takes transitive deps automatic, but correct me if I am wrong here πŸ™‚ Because they sharing same androidx package names it will be resolved automatic I think.
v
I need Material3, Material Icons and all basic compose stuff, like Rows, modifiers, states etc Does Material3 has transitive dependency on runtime and foundation?
p
Sometimes compose.ui
too
j
Right, yeah Row, States etc not part of the Material libs. So then need to add compose.ui, compose.foundation and compose.ui πŸ™‚
p
On foundation I believe
v
its quite confusing, should i add all foundation, runtime and ui , or using ui include both, what all material includes Should be mentioned somewhere
j
So code inside Material has its own resolved things, where not neccessarily same compossable source code youre using in your project, depedning how resolve hthe libraries πŸ˜›
p
The stack from bottom to top is: 1 runtime 2 ui 3 foundation 4 material
j
Imagine you only using Button composable from M3 library, and NOTHING from foundation yourself, then I think only need material πŸ™‚ But in almost all cases need foundation and runtime, so good adding them as well.
p
I add them explicitly all the time
βž• 1
j
https://androidx.tech/artifacts/compose.material3/material3-android/1.2.0 You can see here as of example which deps it has πŸ™‚
Just keep in mind this is for Android target, so different in CMP kind a πŸ™‚
v
I think safest is to add all ,
ui
,
runtime
,
foundation
explicitly
βž• 2
j
@Pablichjenkov Yes me too, just not neccessarly needed but in most cases you probably want it πŸ˜›
Also dont forget compose.materialIconsExtended, if using icons as I think mentioned πŸ™‚
v
Docs should explain this, there are
animation
and
animationGraphics
too, now its included in
ui
or not? Though i can access
Animatable
without it
j
But yeah I totally agree should be more clear in documenation when to use what, and how Jetbrains resolve all these deps based on platform. Like iOS not getting same implementation as Android getting for same class/methods. Especially if override the versions yourself in Gradle can be very tricky.
p
Yes not needed but just for safety. I recall a bug in js target I believe, where you had to explicitly import it