Post

A small but extremely useful foundational API added in #JetpackCompose 1.8: LocalWindowInfo.current.containerSize It's the best way to get the size of the window, which should form the basis for any breakpoint logic for top-level layouts like window size classes. #AndroidDev

The closest built-in ways before were LocalConfiguration.current.screenWidthDp and LocalConfiguration.current.screenHeightDp, but due to insets and rounding they aren't actually the window size. So it's an improvement without needing more code with WindowMetricsCalculator (and knowing to do that)

0 reposts1 like

No replies yet.