Skip to content

Latest commit

 

History

History
21 lines (19 loc) · 595 Bytes

README.md

File metadata and controls

21 lines (19 loc) · 595 Bytes

Jetpack Compose Confirmation Dialog Utils

A utils class for alert dialogs in compose

Just copy the class ConfirmationDialog.kt to you project and use it as below:

@Preview
@Composable
private fun ConfirmationDialogPreview() {
    AppTheme {
        val showDialog = remember { mutableStateOf(true) }
        ConfirmationDialog(
            showDialog = showDialog,
            titleResId = R.string.save_changes,
            bodyResId = R.string.are_you_sure,
            confirmBtnTextResId = R.string.save,
            dismissBtnTextResId = R.string.cancel
        )
    }
}