QuickNotify is a Jetpack Compose library that helps Android developers show Toast messages, Snackbars, Dialogs, and custom alerts using a global overlay system with zero setup.
Works across the entire app without requiring a host Composable in each screen.
- Global overlay via App Startup
- Jetpack Compose UI β Toast, Snackbar, Dialog
- Toast with text + icon + custom duration
- Snackbar with ** icon + custom duration **
- Dialog with:
- Header image
- Title
- Body text
- Up to 3 customizable buttons
- Optional top-right close icon
- Rounded or square corners
- Custom Overlay for showing any Composable UI globally:
- Full control over content, alignment, and appearance.
- Manual or automatic dismissal.
- Coroutine-based visibility handling
- Works across entire application
To display a toast in Jetpack Compose, you can use the QuickNotify library.
Add in settings.gradle.kts:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url = uri("https://jitpack.io") }
}
}dependencies {
implementation("com.github.swatikulkarni123:QuickNotify:1.0.0")
}QuickNotify.showToast("Hello world!")QuickNotify.showToast(
message = "Saved successfully",
duration = 2500L,
icon = Icons.Default.Check
)QuickNotify.showSnackbar(
message = "No internet connection"
)QuickNotify.showSnackbar(
message = "Message sent",
icon = Icons.Default.Send
)Shows a fully customizable dialog with an optional top image,
title, body, and up to 3 buttons.
QuickNotify.showDialog(
title = "Delete Item?",
body = "This action cannot be undone.",
topImage = painterResource(R.drawable.warning),
btn1Text = "Cancel",
btn1Color = Color.Gray,
onBtn1Click = { },
btn2Text = "Delete",
btn2Color = Color.Red,
onBtn2Click = { /* Delete logic */ }
)QuickNotify.showDialog(
title = "Info",
body = "This is message-only dialog."
)This will show a top-right close icon automatically.
Use showOverlay to display any Composable UI in a global overlay. This is ideal for custom alerts, banners, or full-screen loaders.
The content lambda provides a dismiss: () -> Unit function, which you must call to manually dismiss the overlay.
QuickNotify.showOverlay(
overlayAlignment = Alignment.Center, // Position your custom view
autoCancel = false, // Set to true to dismiss after default duration (2000ms) or 'duration'
content = { dismiss -> // 'dismiss' function to manually close the overlay
Card(
// ... your custom UI for the alert ...
shape = RoundedCornerShape(20.dp),
// ...
) {
Row(
// ... your alert content ...
) {
// ...
// Example of a dismiss button inside the custom view
Icon(
// ...
modifier = Modifier.size(20.dp).clickable {
dismiss() // **Crucial: Call dismiss() to close the overlay**
// You can also show another QuickNotify message here
// QuickNotify.showToast("Clicked")
}
)
}
}
}
)- Automatically initializes via
QuickNotifyInitializer - Uses a hidden global Compose host
- Renders Toast/Snackbar/Dialog using:
QuickNotifyHostInternalQuickNotifyController
- Auto-dismiss using coroutine delays
- Manual dismiss:
QuickNotifyController.clear()If using a close icon, place it here:
your-library-module/
βββ src/
βββ main/
βββ res/
βββ drawable/
βββ ic_close.xml
Use inside dialog:
painterResource(R.drawable.ic_close)Jetpack Compose Toast
Compose Snackbar
Compose Dialog
Android Compose Alert