Jan Skrasek
01/26/2022, 10:31 AMPainter
- seems to have mutability issues and I didn't found any copy/clone method.
• @Composable () -> Unit
- for custom rendering icon is too benevolent for me
• @Composable () -> Painter
- is what I'm ended up. Is it the correct solution?Halil Ozercan
01/26/2022, 12:16 PMZoltan Demant
01/26/2022, 1:05 PMPainter
support).
We did this by declaring a sealed interface "IconResource"; a subclass of it is an enum with pointers to things like Icons.Rounded.Check
etc. It has worked really well, and kept our icons streamlined across a pretty large project (~200 modules); the check icon is always rounded, and we can easily switch that out if need be.
We thought we would rely on Painter
for something, but we havent yet. Adding it in would be as easy as declaring another subclass of the sealed interface though. In the icon composable we just derive the icon contents from the subclass specified!