Alternative of snackbar and toast, powerful, customizable, beautiful and easy to use
Library for displaying messages as an alternative to snackbars and toast, which is powerful, easy to customize, and easy to use. Based on Flashbar (AndroidIDE) that based on Flashbar (aritraroy)
- Put this code in settings.gradle.kts (root kotlin dsl) in
repositoriesblock
dependencyResolutionManagement {
repositories {
// example
maven {
url = uri("https://jitpack.io")
}
}
}If using groovy dsl
repositories {
maven { url 'https://jitpack.io' }
}- Put dependencies into build.gradle.kts (app/build.gradle.kts kotlin dsl)
inside the
dependenciesblock
implementation("com.github.hasanelfalakiy:flashbar:${version}")if using groovy dsl
implementation 'com.github.hasanelfalakiy:flashbar:${version}'Flashbar.Builder(this)
.gravity(Flashbar.Gravity.TOP) // or BOTTOM
.title("Hello World!")
.message("This is a message from Flashbar.")
.backgroundColorRes(R.color.colorPrimary)
.build()
.show()In Jetpack Compose, you can use LocalContext to get the Activity.
@Composable
fun MyScreen() {
val context = LocalContext.current
val activity = context as Activity
Button(onClick = {
Flashbar.Builder(activity)
.message("Appears in Jetpack Compose!")
.build()
.show()
}) {
Text("Show Flashbar")
}
}You can now customize the appearance of Flashbar cards to be more flexible.
Flashbar.Builder(activity)
.message("Custom Flashbar")
// Set the elevation (shadow). Use 0f so there are no shadows
.cardElevation(0f)
// Set the corner radius. Use 0f for perfect square corners
.cardCornerRadius(0f)
.build()
.show()If you want to contribute, please fork this repository, clone to your local machine, make changes, push, and then send a pull request to this repository
Copyright 2016 aritraroy
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
flashbar
Copyright (C) 2024 Akash Yadav (AndroidIDE)
... (License details are the same as before)
flashbar
Copyright (C) 2026 Andi Hasan Ashari
... (License details are the same as before)
