generated from bitwarden/template
-
Notifications
You must be signed in to change notification settings - Fork 9
/
BitwardenTwoButtonDialog.kt
68 lines (66 loc) · 2.22 KB
/
BitwardenTwoButtonDialog.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
package com.bitwarden.authenticator.ui.platform.components.dialog
import androidx.compose.material3.AlertDialog
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.graphics.Color
import com.bitwarden.authenticator.ui.platform.components.button.BitwardenTextButton
/**
* Represents a Bitwarden-styled dialog with two buttons.
*
* @param title the optional title to show.
* @param message message to show.
* @param confirmButtonText text to show on confirm button.
* @param dismissButtonText text to show on dismiss button.
* @param onConfirmClick called when the confirm button is clicked.
* @param onDismissClick called when the dismiss button is clicked.
* @param onDismissRequest called when the user attempts to dismiss the dialog (for example by
* tapping outside of it).
* @param confirmTextColor The color of the confirm text.
* @param dismissTextColor The color of the dismiss text.
*/
@Composable
fun BitwardenTwoButtonDialog(
title: String?,
message: String,
confirmButtonText: String,
dismissButtonText: String,
onConfirmClick: () -> Unit,
onDismissClick: () -> Unit,
onDismissRequest: () -> Unit,
confirmTextColor: Color? = null,
dismissTextColor: Color? = null,
) {
AlertDialog(
onDismissRequest = onDismissRequest,
dismissButton = {
BitwardenTextButton(
label = dismissButtonText,
labelTextColor = dismissTextColor,
onClick = onDismissClick,
)
},
confirmButton = {
BitwardenTextButton(
label = confirmButtonText,
labelTextColor = confirmTextColor,
onClick = onConfirmClick,
)
},
title = title?.let {
{
Text(
text = it,
style = MaterialTheme.typography.headlineSmall,
)
}
},
text = {
Text(
text = message,
style = MaterialTheme.typography.bodyMedium,
)
},
containerColor = MaterialTheme.colorScheme.surfaceContainerHigh,
)
}