Make `onCancelClick` nullable

This commit is contained in:
Ensar Sarajčić 2023-10-05 12:47:05 +02:00
parent 15dcb65fbc
commit b5b215af6e
1 changed files with 2 additions and 2 deletions

View File

@ -22,7 +22,7 @@ fun SleepTimerCustomAlertDialog(
alertDialogState: AlertDialogState,
modifier: Modifier = Modifier,
onConfirmClick: (seconds: Int) -> Unit,
onCancelClick: () -> Unit = {}
onCancelClick: (() -> Unit)? = null
) {
var selectedItem by remember { mutableIntStateOf(0) }
var value by remember { mutableStateOf("") }
@ -92,7 +92,7 @@ fun SleepTimerCustomAlertDialog(
horizontalArrangement = Arrangement.End
) {
TextButton(onClick = {
onCancelClick()
onCancelClick?.invoke()
alertDialogState.hide()
}) {
Text(text = stringResource(id = R.string.cancel))