Skip to content

Repository files navigation

Banner

💬 SSCompose-CustomInfoBar 💬

Platform-badgeJetpack Compose-badgeAPI-badgeKotlin VersionRelease-badge

Welcome to our SSCompose-CustomInfoBar Library! 🎉 Tired of generic snackbars? This Jetpack Compose library offers a powerful and customizable way to display informative messages within your app.

⚡ Features

  • Content: Add 💬 text, icons, or even custom composables to your info bar for ultimate flexibility.
  • Position: Display the info bar strategically at the ☝️ top or 👇 bottom of your screen.
  • Duration: Control how long the info bar stays visible, from indefinite to short ⚡ or long : hourglass: durations.
  • Styles: Predefined styles like ⚠️ error, ℹ️ info, and warning are available, or craft your own style with custom background, text color, and icons.
  • Swipe to dismiss: Users can dismiss the info bar with a simple swipe, providing an interactive touch.
  • Look & Feel: 🖌️ Customize the info bar's shape, color, and elevation to seamlessly match your app's design.
  • Theming: Integrate with Jetpack Compose's theming system for a consistent and beautiful look across your app.
  • Animations: 🎉 Liven up your info bars with various built-in entrance and exit animations.
  • Offline Notifications: 📶 A constructor flag which allows to automatically displays an info bar giving "you are offline" notification.
  • Action button: 👍 Optional action button to show on InfoBar.
  • On Dismiss Callback: Get notified about bar dismissal.
  • Queueing System: 🔁 Display multiple info bars sequentially.

NOTE:

  • Scroll to show and hide info bar feature work only with LazyListState.
  • If the duration of infoBar is infinite then the queue feature won't work.
  • Currently there is no limit to how many info bars can be added to queue for displaying.

🖼️ Preview

Full Preview
CustomInfobar-Preview.mp4
Default DemoError ThemedWarning Themed
Success ThemedAnnotated StringsGradient Background
SVG BackgroundPNG BackgroundAction Button

📚 How it works:

  1. Add the dependency in your app's build.gradle file

    dependencies {
    implementation("com.github.SimformSolutionsPvtLtd:SSCompose-CustomInfoBar:1.0")
    }
  2. Add the JitPack repository

    For latest Android Studio, in settings.gradle file inside dependencyResolutionManagement block

    dependencyResolutionManagement {
    repositories {
    ...
    maven { url = uri("https://jitpack.io") }
    }
    }
  3. Create ComposeInfoHost with default parameters to host ComposeInfoBar (NOTE: Here we are not passing an custom ComposeInfoBar so it will use a default implementation. To show custom ComposeInfoBar check out SSComposeInfoHost-Customisation-Guide)

    val composeInfoHostState by remember {
    mutableStateOf(SSComposeInfoHostState())
    }
    SSComposeInfoHost(
    modifier =Modifier
    .fillMaxSize(),
    composeHostState = composeInfoHostState
    ) {
    MainComposable()
    }
  4. Show composeInfoBar anywhere in your project

    val coroutineScope = rememberCoroutineScope()
    var duration by remember {
    mutableStateOf(SSComposeInfoDuration.Short)
    } coroutineScope.launch { composeInfoHostState.show(
    infoBarData =SSComposeInfoBarData(title, description),
    duration = duration
    )
    }
  5. For full customisation of SSComposeInfoBar checkout SSComposeInfoBar-Customisation-Guide

❤️ Find this samples useful?

Support it by joining stargazers ⭐ for this repository.

🤝 How to Contribute?

Whether you're helping us fix bugs, improve the docs, or a feature request, we'd love to have you! : muscle:
Check out our Contributing Guide for ideas on contributing.

🐞 Bugs and Feedback

For bugs, feature requests, and discussion use GitHub Issues.

🚀 Other Mobile Libraries

Check out our other libraries Awesome-Mobile-Libraries.

⚖️ License

Distributed under the MIT license. See LICENSE for details.

About

Welcome to SSCompose-CustomInfoBar Library! Customize info bars with text, icons, or custom components. Control visibility ⏳, use predefined or custom styles 🎨, and enable swipe-to-dismiss 🧹, theming 🖌️, animations 🎉, offline alerts 📵, action buttons 👍, and queueing 🔁.

Topics

Resources

Contributing

Stars

36 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages