Skip to content

Commit

Permalink
Merge pull request #119 from kalinjul/main
Browse files Browse the repository at this point in the history
Add DialogProperties parameter for resizing dialog content
  • Loading branch information
PranavMaganti committed Dec 21, 2021
2 parents 778b937 + 8ef505c commit 35fe094
Showing 1 changed file with 7 additions and 1 deletion.
Expand Up @@ -33,6 +33,7 @@ import androidx.compose.ui.platform.testTag
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import androidx.compose.ui.window.Dialog
import androidx.compose.ui.window.DialogProperties
import java.util.concurrent.atomic.AtomicInteger
import kotlin.math.min

Expand Down Expand Up @@ -204,6 +205,7 @@ fun rememberMaterialDialogState(initialValue: Boolean = false): MaterialDialogSt
/**
* Builds a dialog with the given content
* @param dialogState state of the dialog
* @param properties properties of the compose dialog
* @param backgroundColor background color of the dialog
* @param shape shape of the dialog and components used in the dialog
* @param border border stoke of the dialog
Expand All @@ -216,6 +218,7 @@ fun rememberMaterialDialogState(initialValue: Boolean = false): MaterialDialogSt
@Composable
fun MaterialDialog(
dialogState: MaterialDialogState = rememberMaterialDialogState(),
properties: DialogProperties = DialogProperties(),
backgroundColor: Color = MaterialTheme.colors.surface,
shape: Shape = MaterialTheme.shapes.medium,
border: BorderStroke? = null,
Expand Down Expand Up @@ -248,7 +251,10 @@ fun MaterialDialog(
elevation = elevation
) ?: MaterialTheme.colors.surface

Dialog(onDismissRequest = { onCloseRequest(dialogState) }) {
Dialog(
properties = properties,
onDismissRequest = { onCloseRequest(dialogState) }
) {
Surface(
modifier = Modifier
.fillMaxWidth()
Expand Down

0 comments on commit 35fe094

Please sign in to comment.