Object

SnackbarDefaults

Object to hold defaults used by Snackbar

Source set: Common

Added in 1.11.0-rc01

object SnackbarDefaults

Object to hold defaults used by Snackbar

Properties

backgroundColor

Source set: Common

Added in 1.11.0-rc01

val backgroundColor: Color

Default background color of the Snackbar

primaryActionColor

Source set: Common

Added in 1.11.0-rc01

val primaryActionColor: Color

Provides a best-effort 'primary' color to be used as the primary color inside a Snackbar. Given that Snackbars have an 'inverted' theme, i.e. in a light theme they appear dark, and in a dark theme they appear light, just using Colors.primary will not work, and has incorrect contrast.

If your light theme has a corresponding dark theme, you should instead directly use Colors.primary from the dark theme when in a light theme, and use Colors.primaryVariant from the dark theme when in a dark theme.

When in a light theme, this function applies a color overlay to Colors.primary from MaterialTheme.colors to attempt to reduce the contrast, and when in a dark theme this function uses Colors.primaryVariant.

Last updated: