Is it possible to merge `Preview` annotations? Fo...
# compose
Is it possible to merge
annotations? For example, if I have a
annotation class FontScalePreviews
annotated with a bunch of different
set, and a
annotation class DensityScalePreviews
with a bunch of different
set, can I create another annotation that merges those?
I tried this, and it seems like when it encounters that, it renders multiple previews. The Preview annotation is allowed to be specified multiple times, so that you can see a variety of different preview configurations of a single function. I'm not convinced there's a way to have it merge the attributes together. So while you can create a composite annotation, there's no way to mix and match. Each Preview annotation gets rendered on it's own
Yeah, the current behavior is that each underlying
annotation will be rendered, and they won’t “cross-multiply” to apply combinations. That would be cool for `@Preview`s that have orthogonal parameters specified, but I’m not sure how you’d handle cases where multiply `@Preview`s specify the same conflicting parameter. You would probably just have to make a new multi-preview annotation with the manual merging.
I was imagining some way of specifying which parameters to merge. I was able to achieve this by just exploding the Preview annotations for every combination of font scale and density that I wanted, but there's a lot 😬