When designing for multiple window sizes is it bad...
# compose
c
When designing for multiple window sizes is it bad practice to have the
widthSizeClass
as part of a composition local that any of my composables can access? In some of the sample projects for compose (Reply) they pass a variable to every composable that tells it what to display. This feels like it could pretty messy with a ton of screens.
a
I’d be cautious whenever adding a new
CompositionLocal
for fear of code becoming a bit more magical and harder to test. The version in
material3-adaptive
for getting the window size class (currentWindowAdaptiveInfo) is just a plain
@Composable
and doesn’t require passing down information quite as much.
c
Oh cool. Didn't know this existed! After thinking about it for a while it wouldn't be that bad to pass in to the composables that need it vs doing the check in the screens that do. First pass at doing multi-window app development growing pains 😅 Thanks for dropping this knowledge nugget Though :)