Hi! Is there a way to have different Snackbar col...
# compose
a
Hi! Is there a way to have different Snackbar colors? On our design system we have 3 snackbar types: Success (green), Info (default), Error (red)
a
you could wrap the snackbar in a theme with the correct colors set, or maybe just set the
backgroundColor
?
there’s some special handling going on in the SnackbarDefaults:
Copy code
val backgroundColor: Color
        @Composable
        get() =
            MaterialTheme.colors.onSurface
                .copy(alpha = SnackbarOverlayAlpha)
                .compositeOver(MaterialTheme.colors.surface)
a
but, using
scaffoldState
we don't have access to that, isn't?
a
Ah, you’re using the version where you just set the message?
a
yes
a
I went for the easy route without the scaffold so I’m not so sure how to fix that one 😞
a
I end up doing a wrapper for
Scaffold
with our custom
SnackbarState
and
SnackbarHost
👍 1