Stylianos Gakis
03/05/2023, 12:05 AMWindowSizeClass
when inside a composable preview?
If for example in preview I’ve set device = "spec:width=Xdp,height=Ydp,dpi=240",
which would end up making it look like a wide tablet, can I somehow get the WindowSizeClass to look at those values instead?
Right now I am in reality making some decisions which render the UI differently in such screens, but in the previews this is not reflected since I have to construct one of these objects manually, like WindowSizeClass.calculateFromSize(DpSize(500.dp, 300.dp)),
which obviously don’t match what the preview actually shows.Albert Chang
03/05/2023, 2:23 PMscreenWidthDp
and screenHeightDp
from LocalConfiguration.current
. They should be good enough for previews.Stylianos Gakis
03/05/2023, 8:24 PM