Hi everyone, for dimensions Someone suggested me ...
# compose-android
s
Hi everyone, for dimensions > Someone suggested me to use
expect/actual
like this: >
Copy code
expect object Dimensions {
>     val buttonHeight: Dp
>     val smallPadding: Dp
> }
> and on actual for android - use android's dimens resources. in actual for iOS - use size classes by code. in actual for desktop/web - use constants or some that will resolve your task Is this possible to use android's dimens resources in actual implementation of this Dimensions class, I tried but i am not able to access those androidApp dimens resources in kmm androidMain module's actual implemention.
t
I would recommend to not use the android dimes resource files at all. They are only available in Android. Better to just define this in one kotlin file.
s
Ok thnx
t
But in theory i would assume that it should be possible to access the resources in android actual implementation.
s
Yea, i was also thinking so, thats why i was trying. But i was not able to access them, dont know why if i type R.dimen.any_item_name, It does not suggest me resources from defined dimens from androidApp, but it suggests few dimensions which are from android library
t
This happens normally when you do import the wrong R package. Make sure to import the local namespace R file.
s
importing the local ones related to my package,What i mean is that for system dimensions, its showing suggestions, BUt not from local ones
t
For me it works. Do you use Android Studio or IntelliJ?
I just tested it on the example project https://github.com/JetBrains/compose-multiplatform/tree/master/examples/codeviewer With Android Studio
Maybe you configured some thing wrong? You could use this project to check.
s
Yea may be something is wrong here, i will check it. thnx