Closed alvindizon closed 2 years ago
If you're pure compose this could simply be a Kotlin class somewhere like in core-designsystem module. What else would you expect to gain from a dimens.xml file in compose? I'm curious myself too tbh.
@StylianosGakis I was thinking you can have different dimens.xml for different densities, but you could technically do the same in Compose I imagine, you can do something similar to the method in this post
It would be cool to see how the Android team would handle font and spacing units for different densities
@StylianosGakis @alvindizon mmm, i undestand that you can use the similar approach for shapes or colors using kotlin objects for dimensions, in that sense, you could define the dimentions that are used in a common way (for example, a attribute in the Dimensions object with value of {n}.dp for textSize of a TitleTextComposable). @alvindizon theres a library, accompanish, that could sove something related to reuse xml in themes and styles for jetpack compose apps. you can check it out.
I'm going to close this issue as not directly being related to the project, and more of a guidance and recommendation request.
dimensionResource
will work, and would definitely make sense if you're sharing dimensions with non-Compose code as well. If you're fully Compose (like this app) than either approach will work and at that point, it's a matter of preference.
Looking in this repo, there is no use of
dimens.xml
anddimensionResource
and sizes are used directly such as18.dp
. Is this the recommended way of using sizes now?