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
Alex Vanyo
02/20/2024, 9:23 PM
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
and doesn’t require passing down information quite as much.
c
Chris Johnson
02/21/2024, 12:30 AM
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 :)