From 2b479d1d3f9196b1d58cdbb665ec1000d9ac15a5 Mon Sep 17 00:00:00 2001 From: Abdelilah El Aissaoui Date: Thu, 2 Dec 2021 01:55:04 +0100 Subject: [PATCH] Added popupPositionProvider to MaterialDialog --- src/main/kotlin/app/ui/dialogs/MaterialDialog.kt | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/main/kotlin/app/ui/dialogs/MaterialDialog.kt b/src/main/kotlin/app/ui/dialogs/MaterialDialog.kt index d11f873..3b6617e 100644 --- a/src/main/kotlin/app/ui/dialogs/MaterialDialog.kt +++ b/src/main/kotlin/app/ui/dialogs/MaterialDialog.kt @@ -14,15 +14,26 @@ import androidx.compose.ui.draw.alpha import androidx.compose.ui.draw.clip import androidx.compose.ui.graphics.Brush import androidx.compose.ui.graphics.Color -import androidx.compose.ui.unit.dp +import androidx.compose.ui.unit.* import androidx.compose.ui.window.Popup +import androidx.compose.ui.window.PopupPositionProvider @Composable fun MaterialDialog( alignment: Alignment = Alignment.Center, content: @Composable () -> Unit ) { - Popup(focusable = true) { + Popup( + focusable = true, + popupPositionProvider = object: PopupPositionProvider { + override fun calculatePosition( + anchorBounds: IntRect, + windowSize: IntSize, + layoutDirection: LayoutDirection, + popupContentSize: IntSize + ): IntOffset = IntOffset.Zero + } + ) { Box( modifier = Modifier .fillMaxSize()