Created
July 16, 2022 17:01
-
-
Save damianpetla/714f52cac8a5dab1c0a251978eb379f2 to your computer and use it in GitHub Desktop.
MD3 Snackbar sample
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val snackBarState = remember { SnackbarHostState() } | |
Scaffold( | |
modifier = Modifier.fillMaxSize(), | |
snackbarHost = { | |
SnackbarHost(hostState = snackBarState) { | |
Snackbar { | |
Text(text = it.visuals.message) | |
} | |
} | |
}, | |
floatingActionButton = { | |
FloatingActionButton(onClick = { | |
snackBarState.showSnackbar("Scanned $it") | |
}) { | |
Icon(imageVector = Icons.Default.Scanner, contentDescription = null) | |
} | |
}, | |
floatingActionButtonPosition = FabPosition.End | |
) { padding -> | |
//content | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment