Skip to main content

CamoSnackbar

Snackbars are shown through the app's messenger, which the root provider installs. There is no widget to place: call show from anywhere below the provider. One snackbar shows at a time and the rest queue in order. show returns how the snackbar ended, so you can tell whether the user pressed the action.

Usage​

val messenger = Camouflage.messenger
val scope = rememberCoroutineScope()

scope.launch {
val result = messenger.show("Message archived", action = "Undo")
if (result == SnackbarResult.ActionPerformed) undoArchive()
}

// A status tone
scope.launch { messenger.show("Could not save", tone = Tone.Error) }
Design notes

Why CamoSnackbar works this way, its states and its edge cases: contributor docs.