chanjungskim
02/21/2023, 6:46 AMefemoney
02/21/2023, 7:02 AMDensity
of the desktop app so that it is x times bigger for the same size on mobile.
OR
You could create a Int.pxAsDp
read composable that will allow you define px dimensions as Dp. and use that everywhere
val Int.pxAsDp
@ReadOnlyComposable
@COmposable
get() = with(LocalDensity.current) { toFloat().toDp }
chanjungskim
02/21/2023, 7:03 AMchanjungskim
02/21/2023, 7:03 AMchanjungskim
02/21/2023, 7:04 AMModifier.width(with(LocalDensity.current){209.3.dp})
.height(with(LocalDensity.current){136.7.dp})
efemoney
02/21/2023, 7:06 AMwith
part is unused!efemoney
02/21/2023, 7:07 AMchanjungskim
02/21/2023, 7:13 AMefemoney
02/21/2023, 7:14 AMwith(LocalDensity.current){209.3.dp}
efemoney
02/21/2023, 7:15 AM.dp
still just calls the Dp constructor. You need .toDp
insteadgildor
02/21/2023, 9:07 AMthe size must look bigger.So you just want to scale it up? I feel that better solution, if you want to increase size on larger screens, would be use different sizes selected by WindowSizeClass not try to just scale it up, dp wouldn’t help in this case anyway, because dp is specified by device and they are not equal for different devices anyway, so cannot be used for your case, as I understand it
gildor
02/21/2023, 9:08 AM