spierce7
02/15/2022, 7:42 PMwith(LocalDensity.current) {
window.minimumSize = Dimension(400.dp.roundToPx(), 250.dp.roundToPx())
}
Is there a way to subscribe to the local density as state so that if it changes it triggers a re-draw?Dominaezzz
02/15/2022, 8:00 PMsnapshotFlow { LocalDensity.current }.collectAsState()
is one way but might not be the right one for you. It depends on what the re-draw code looks like.spierce7
02/15/2022, 8:24 PMsnapshotFlow
’s lambda isn’t a @Composable
, so that doesn’t work exactly.Dominaezzz
02/15/2022, 11:29 PMAlbert Chang
02/16/2022, 3:49 AMLocalDensity
is a CompositionLocal
.spierce7
02/16/2022, 5:29 AMwith(LocalDensity.current) {
window.minimumSize = Dimension(400.dp.roundToPx(), 250.dp.roundToPx())
}
The minimum sizes were drastically different when I was moving between my monitors.Albert Chang
02/16/2022, 6:33 AMLocalDensity.current
did change and isn't that what you want?Igor Demin
02/16/2022, 12:18 PMDisposableEffect(Unit) {
window.minimumSize = Dimension(400, 250)
onDispose {}
}