Any method to get the width of the window in dp in the compose multi-platform? I want to adjust the width of a composable to a fraction of the window width minus 48.dp, which will automatically change when the window is resized.
✅ 1
Abhishek Das
06/06/2024, 7:09 AM
Currently I do it by fixing the window width and not allowing the user to resize the window, but it is not an ideal way to do it
Abhishek Das
06/06/2024, 8:10 AM
rememberWindowState.size.width
doesn't seem working as expected
a
Alexander Maryanovsky
06/06/2024, 9:25 AM
LocalWindowInfo.containerSize
, but note that this is not available on Android
a
Abhishek Das
06/29/2024, 2:14 PM
For those who are finding this on search, please follow the below example:
Copy code
val state = rememberWindowState()
Window(
onCloseRequest = ::exitApplication,
state = state
) {
val windowWidth = state.size.width
}