How can I get the current orientation of the devic...
# compose
r
How can I get the current orientation of the device in a composable?
i
This is generally not actually what you want, given that in cases such as split screen multi-window on a phone, you'll be in "landscape" (just because the window's width > its height). Have you looked at `onSizeChanged`: https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/package-summary#onsizechanged
☝️ 1
r
I'm still thinking about how I'd like to lay this out in that case, but I expect that in order to fit everything without having to resort to a scrolling view (which I'd prefer) I would need to adjust parts of the view more than I would be able to with that (e.g. turning a
Row
of buttons into a
Column
)
a
you can use
WithConstraints
where you check
if(maxWidth > maxHeight)
for the dynamic size of your component, or you can use
ConfigurationAmbient
for the sizes of your screen. either of these two should work better than
onSizeChanged
199 Views