Fancy Jetpack Compose Dialogs

“Elevate your app’s dialogs with ‘FancyJetpackComposeDialogs‘ using Jetpack Compose magic! ✨?”

Introduction

Introducing “FancyJetpackComposeDialogs“! ? Elevate your app with captivating dialogs using Jetpack Compose. With ComposeDialogs, displaying dialogs in your app becomes a breeze. whether it’s success messages, errors, information, or warnings, this library offers a range of dialog types with unique designs. ?

✨. Experience both the classic dialog style and an innovative upper-cut design, all while enjoying the simplicity and elegance of Jetpack Compose. Try it now to enhance your user experience! ?? #FancyJetpackComposeDialogs

Made with love ❤️ by Pratik Fagadiya

Types Of Dialog

1. Success Dialog 2. Fancy Success Dialog 3. Error Dialog
4. Fancy Error Dialog 5. Warning Dialog 6. Fancy Warning Dialog
7. Information Dialog 8. Information Action Dialog

Implementation

Implementation of FancyJetpackComposeDialogs library is so easy. You can check /app directory for demo. Let’s have look on basic steps of implementation.

Prerequisite

Add JitPack repository to your project’s settings.gradle file.

dependencyResolutionManagement {  
 // ...  
 repositories {
    // ...
    maven { url "https://www.jitpack.io" }
 }}  

Declare the dependencies in the module-level build.gradle file ?

 dependencies { implementation 'com.github.PratikFagadiya:FancyJetpackComposeDialog:<LATEST_VERSION>' }

How to use it ?

Fancy dialogs come in four types: Success, Error, Warning, and Informative. Each type is designed to communicate a specific message to the user in a visually appealing way.

Fancy dialogs provide an easy and customizable way to show different types of messages to users in a visually appealing manner. Let’s have a look in SuccessFancyDialog.

SuccessFancyDialog

SuccessFancyDialog displays a success message with customizable options.

Usage Example

@Composable
fun showSuccessDialog() {
    var showNormalSuccessDialog by remember { mutableStateOf(false) }

    if (showNormalSuccessDialog) {
        SuccessFancyDialog(title = "Normal Success Dialog",
            message = "Normal dialog with 2 button and with custom font",
            dialogProperties = DialogButtonProperties(
                positiveButtonText = R.string.yes
            ),
            fontFamily = Poppins,
            dismissTouchOutside = {
                showNormalSuccessDialog = false
            },
            positiveButtonClick = {
                showNormalSuccessDialog = false
                Toast.makeText(
                    context, context.getString(R.string.positive_button_clicked), Toast.LENGTH_SHORT
                ).show()
            },
            negativeButtonClick = {
                showNormalSuccessDialog = false
                Toast.makeText(
                    context, context.getString(R.string.negative_button_clicked), Toast.LENGTH_SHORT
                ).show()
            })
    }
}

Parameters

  • showTitle: Boolean (default: true)
  • title: String (default: “”)
  • showMessage: Boolean (default: true)
  • message: String (default: “”)
  • dialogStyle: DialogStyle (default: DialogStyle.NORMAL)
  • dialogActionType: DialogActionType (default: DialogActionType.ACTIONABLE)
  • dialogProperties: DialogButtonProperties (default: DialogButtonProperties())
  • fontFamily: FontFamily (default: FontFamily.Default)
  • isCancelable: Boolean (default: true)
  • dismissTouchOutside: () -> Unit
  • positiveButtonClick: () -> Unit (default: {})
  • negativeButtonClick: () -> Unit (default: {})
  • neutralButtonClick: () -> Unit (default: {})

The same parameters will work on any types of dialogs

You can check MainActivity file for multiple types of dialog implementation.

Donate

If you found this library helpful or you learned something from the source code and want to thank me, consider buying me a cup of ☕

"Buy Me A Coffee"

Find this library useful ? ❤️

  • Support it by clicking the ⭐️ button on the upper right of this page and share with others. ✌️

    Also, follow me on github and _ twitter_ to stay updated with my creations! ?

Contribution ?

Connect with me

License ?

Apache 2.0 License  
  
Copyright 2023 Pratik Fagadiya  
  
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.0Unless 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.  

GitHub

View Github