showSnackbar

suspend fun showSnackbar(message: String, tone: JengaSnackbarTone = JengaSnackbarTone.Neutral, actionLabel: String? = null, duration: JengaSnackbarDuration = JengaSnackbarDuration.Short): JengaSnackbarResult(source)

Shows a snackbar and suspends until it is dismissed or its action is tapped. A second call while one is showing replaces the current snackbar.

Return

whether the action was performed or the snackbar was dismissed.

Parameters

message

the message to display.

tone

the semantic tone (accent dot); see JengaSnackbarTone.

actionLabel

optional action label.

duration

how long it stays; defaults to JengaSnackbarDuration.Short even with an action, so an Undo never sits on screen indefinitely. Pass JengaSnackbarDuration.Long for a comfortable Undo window, or JengaSnackbarDuration.Indefinite to keep it until acted upon.


suspend fun showSnackbar(message: String, durationMillis: Long, tone: JengaSnackbarTone = JengaSnackbarTone.Neutral, actionLabel: String? = null): JengaSnackbarResult(source)

Shows a snackbar for exactly durationMillis, or until its action is tapped, and suspends until then.

Return

whether the action was performed or the snackbar was dismissed.

Parameters

message

the message to display.

durationMillis

how long the snackbar stays, in milliseconds.

tone

the semantic tone (accent dot); see JengaSnackbarTone.

actionLabel

optional action label.