Any method to get the width of the window in dp in...
# compose-desktop
a
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
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
rememberWindowState.size.width
doesn't seem working as expected
a
LocalWindowInfo.containerSize
, but note that this is not available on Android
a
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
}