Are there clear conventions on where to put a Back...
# compose-wear
y
Are there clear conventions on where to put a Background on Composables? Or where assumptions about MaterialTheme.colors.background are applied. I just did a deep dive investigating an issue reported for the Media UI and think I've come to the conclusion that user code should almost never set a background, unless it's specific to a Screen such as Artwork.
My mental model is now
There is a system level background - for an Activity this is Black (or probably set by the theme?)
Awkwardly for Android Studio previews it seems to be a washed out dark gray in some cases, but need to investigate more. For Paparazzi it's effectively transparent, so following my new rule above I need to set the background myself in the test case.
The SwipeDismissableNavHost, has a SwipeToDismissBox, which applies MaterialTheme.colors.background, so typically everything in your app has this background. Nothing above the NavHost affects the background.
Does Colors.background get used elsewhere, i.e. mixed with other colors for components like Chips? OR if I do apply a screen background, maybe even non uniform like a gradient or image, will colors above that mix correctly?
message has been deleted
j
We have actually spotted a few places where we didn't have the right background behind our gradients for Chip which we are fixing at the moment
Some components like
Chip
Card
and
Button
will have a natural background (most of time). Most containers should probably not have
👍🏻 1
y
Sounds like I'm doing the right thing with this PR. https://github.com/google/horologist/pull/246
Thanks