showSnackbar

suspend fun showSnackbar(message: String, actionLabel: String? = null, icon: SparkIcon? = null, title: String? = null, intent: SnackbarIntent = SnackbarDefaults.intent, withDismissAction: Boolean = false, duration: SnackbarDuration = if (actionLabel == null) { SnackbarDuration.Short } else { SnackbarDuration.Indefinite }): SnackbarResult(source)

Shows or queues to be shown a Snackbar at the bottom of the com.adevinta.spark.components.scaffold.Scaffold to which this state is attached and suspends until the snackbar has disappeared.

SnackbarHostState guarantees to show at most one snackbar at a time. If this function is called while another snackbar is already visible, it will be suspended until this snackbar is shown and subsequently addressed. If the caller is cancelled, the snackbar will be removed from display and/or the queue to be displayed.

To change the Snackbar appearance, change it in 'snackbarHost' on the com.adevinta.spark.components.scaffold.Scaffold.

Return

SnackbarResult.ActionPerformed if option action has been clicked or SnackbarResult.Dismissed if snackbar has been dismissed via timeout or by the user

Parameters

message

The message to display in the Snackbar.

icon

An optional icon to override the default intent icon.

intent

The intent of the Snackbar.

title

An optional title to be displayed above the message.

actionLabel

optional action label to show as button in the Snackbar

duration

duration to control how long snackbar will be shown in SnackbarHost, either SnackbarDuration.Short, SnackbarDuration.Long or SnackbarDuration.Indefinite.


Shows or queues to be shown a Snackbar at the bottom of the com.adevinta.spark.components.scaffold.Scaffold to which this state is attached and suspends until the snackbar has disappeared.

SnackbarHostState guarantees to show at most one snackbar at a time. If this function is called while another snackbar is already visible, it will be suspended until this snackbar is shown and subsequently addressed. If the caller is cancelled, the snackbar will be removed from display and/or the queue to be displayed.

Return

SnackbarResult.ActionPerformed if option action has been clicked or SnackbarResult.Dismissed if snackbar has been dismissed via timeout or by the user

Parameters

visuals

SnackbarSparkVisuals that are used to create a Snackbar