This library is inspired by Flashbar from legacy android, while it is completely unusable in Jetpack Compose, so I decided to make one in compose by referencing MessageBarCompose.
Super thanks for these inspiration and implementation.
First, you need to wrap all the content into FlashbarContainer which allows the Flashbar message to be displayed.
val flashbarState = rememberFlashbarState()
FlashbarContainer(
state = flashbarState
) {
// your main content
}Then, you can show a message using the FlashbarState like following:
// show info
flashbarState.info("Info Message")
// show error
flashbarState.error("Error message")Available parameters are:
flashbarState.info(
text: String,
icon: ImageVector,
actions: List<FlashbarAction>,
duration: Long
)