Bradleycorn
09/07/2021, 8:49 PMerror
color. Typically it should use error
color for the text color and to tint the icon….
However, in some cases this composable may be called from a Surface()
that has its (background) color set to the theme’s primaryColor
. In these cases, I’d want error composable to render with its background as the error
color (and use onError
for the text color and to tint the icon). I’m wondering how to achieve this?
One idea is to create a CompositionLocal
that is consumed by my ErrorMessage
composable, and I can set its values appropriately in the Surface
to control how errors will appear in that surface. Does that seem like the right approach? Is there another way to accomplish this?