https://kotlinlang.org logo
#compose
Title
# compose
t

timmy

03/04/2021, 4:38 PM
hello please what's the equivalent of this compose desktop code in mobile:
LocalAppWindow.current.height
j

jim

03/04/2021, 4:56 PM
What is your use case? If you are building responsive layouts, it's generally a better practice to use
BoxWithConstraints
which gives you information about the amount of space available for a particular widget (which could be used near the root for whole page layout decisions or at the leaves for when widgets are a little more squished/comfortable). You can then use the constraint (size) information to make all sorts of decisions from which layouts to choose, to which widgets/data to render, to how much padding should be on an object. It gives you a lot of flexibility, allows you to think in a more modular way, and not depend on platform specific APIs.
t

timmy

03/04/2021, 4:58 PM
hmm the use case for this is getting the height of screen automatically
z

zoha131

03/04/2021, 5:08 PM
How about ``LocalConfiguration.current.screenHeightDp`
t

timmy

03/04/2021, 5:11 PM
thanks @zoha131 it works👍
@jim thanks for the explanation, would definitely go that way to make it responsive when i'm working with an implementation like that