Playing around with Jetsnack sample. The project compiles and works fine. But the preview is broken because it is unable to handle the SystemUI padding modifier. Under the hood is NPE about InsetAmbient.current is NULL.
I believe this is the case when the Preview can't provide the framework's Window(or any other components) and it breaks. Will Preview support such things in the future or we(developers) have to avoid of passing any Contexts, Windows, etc to composable functions that must work inside Preview?
I remember exactly the same thing happening with the legacy Design Editor. When you are working on a custom widget you have to use
isInEditMode
to make the preview works fine.
Will Compose Preview have something similar to
isInEditMode
or maybe other elegant solutions?
a
Adam Powell
08/28/2020, 11:08 PM
in this case the insets code probably just needs a fix to have a default value
please file bugs for anything that is part of the core compose libraries that doesn't work in the preview
👍 1
and file sample bugs of that sort on the github repo 🙂