DetailDialogsShell (finally!) platform independent and moved to shared
This commit is contained in:
@@ -4,9 +4,11 @@ import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.platform.LocalDensity
|
||||
import androidx.compose.ui.unit.Dp
|
||||
import androidx.compose.ui.unit.dp
|
||||
import kotlinx.cinterop.ExperimentalForeignApi
|
||||
import platform.UIKit.UIScreen
|
||||
import platform.CoreGraphics.CGRectGetHeight
|
||||
|
||||
@OptIn(ExperimentalForeignApi::class)
|
||||
@Composable
|
||||
actual fun platformScreenHeightDp(): Dp {
|
||||
// UIKit gives points; convert to Compose dp via LocalDensity for safety.
|
||||
@@ -16,3 +18,12 @@ actual fun platformScreenHeightDp(): Dp {
|
||||
return with(density) { heightPoints.toFloat().dp }
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalForeignApi::class)
|
||||
@Composable
|
||||
actual fun platformScreenWidthDp(): Dp {
|
||||
// UIKit gives points; convert to Compose dp via LocalDensity for safety.
|
||||
val heightPoints: Double = CGRectGetHeight(UIScreen.mainScreen.bounds)
|
||||
val density = LocalDensity.current
|
||||
// Compose dp ~= iOS points; still convert explicitly.
|
||||
return with(density) { heightPoints.toFloat().dp }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user