diff --git a/app/src/main/java/org/dhis2/utils/customviews/MoreMenuView.kt b/app/src/main/java/org/dhis2/utils/customviews/MoreMenuView.kt index b01a0607f2..0f745985b7 100644 --- a/app/src/main/java/org/dhis2/utils/customviews/MoreMenuView.kt +++ b/app/src/main/java/org/dhis2/utils/customviews/MoreMenuView.kt @@ -1,10 +1,13 @@ package org.dhis2.utils.customviews +import android.content.res.Resources +import androidx.compose.foundation.layout.widthIn import androidx.compose.material.icons.Icons import androidx.compose.material.icons.outlined.MoreVert import androidx.compose.material3.Icon import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier +import androidx.compose.ui.unit.Dp import org.hisp.dhis.mobile.ui.designsystem.component.IconButton import org.hisp.dhis.mobile.ui.designsystem.component.menu.DropDownMenu import org.hisp.dhis.mobile.ui.designsystem.component.menu.MenuItemData @@ -31,6 +34,7 @@ fun MoreOptionsWithDropDownMenuButton( } DropDownMenu( + modifier = Modifier.widthIn(max = 0.7.dw), items = dropDownMenuItems, expanded = expanded, onDismissRequest = { onMenuToggle(false) }, @@ -39,3 +43,8 @@ fun MoreOptionsWithDropDownMenuButton( onItemClick(itemId) } } + +inline val Double.dw: Dp + get() = Resources.getSystem().displayMetrics.let { + Dp(value = ((this * it.widthPixels) / it.density).toFloat()) + }