https://kotlinlang.org logo
f

fabio.carballo

10/16/2020, 8:29 AM
what is the best practice regarding the
Component
to use to just represent the
background
? I understand the in MaterialTheme the
Surface
has a similar goal, but it takes by default the
surfaceColor
. In my case where I want the same practical use but so that the background color is always
backgroundColor
. From looking at usages, it seems only
Scaffold
actually uses this color, but internally still uses a
Surface
and changes the background color.
2
n

nickbutcher

10/16/2020, 10:41 AM
either: 1 pass a different argument to surface
Surface(color = MaterialTheme.colors.background,…
or 2 Create a composable wrapping surface:
Copy code
@Composable fun BackgroundSurface(color: Color = MaterialTheme.colors.background, …) {
  Surface(color = color, …)
}
🚀 1
f

fabio.carballo

10/16/2020, 12:22 PM
ah great, I actually had followed number 2 ! thanks again for all the support here. the experience we are having of migrating our design system to Compose has been extremely good!