Vlad
08/30/2023, 2:00 PM16.dp
e.g. (Spacer(Modifier.height(16.dp)
, Modifier.padding(top = 16.dp)
etc).
So I have 2 questions:
1. Would it be good idea to create some global constants for such commonly used stuff and reuse them. Basically following M3 tokens design aka:
internal object TypeScaleTokens {
val BodyLargeFont = TypefaceTokens.Plain
val BodyLargeLineHeight = 24.0.sp
val BodyLargeSize = 16.sp
val BodyLargeTracking = 0.5.sp
...
}
2. And second though, would it be good performance vice? I mean, it computes something every time you call 16.dp
, I understand it is fast sure, but when you have it 100 hundred times at the same screen.ascii
08/30/2023, 2:07 PM16f
In any case, to reduce possibilities of human error, it's better to put your common values contained somewhere. I wish M3 token objects were not marked internal; there are many times I wish to re-use existing definitions instead of tracking my own.Vlad
08/30/2023, 2:11 PM