Is not possible to preview a composable in Compose...
# compose-desktop
p
Is not possible to preview a composable in Compose Desktop? I searched everywhere, google, stackoverflow, and a lot of places like these: https://github.com/JetBrains/compose-multiplatform/tree/master/tutorials https://www.jetbrains.com/help/kotlin-multiplatform-dev/compose-desktop-components.html Cannot find how to preview a composable in Compose Desktop. For example:
Copy code
@Preview
@Composable
fun MainScreenPreview() {
    MaterialTheme {
        MainScreen()
    }
}
I can't see anywhere a button for displaying the preview.
p
so not supported in Android Studio
😕
thanks
k
this is Android Studio 🙂
c
But it does not support compose multiplatform composables, right?
Image from iOS.jpg
p
@Konstantin Tskhovrebov Thanks, I installed it, and I have the preview in my commonMain ui package, but I can't see any button for displaying the preview
on the other hand, I installed Fleet, and can't use the preview either, I got this exception:
Failed to invoke Composable Method 'com.package.ui.MainScreenKt.MainScreenPreview'.
Caused by: java.lang.reflect.InvocationTargetException
Caused by: java.lang.IllegalStateException: No ViewModelStoreOwner was provided via LocalViewModelStoreOwner
k
support for developing Compose for Desktop
common previews work in the fleet only
p
and that exception under fleet how can be solved?
k
ask in #CJLTWPH7S
p
seems to be an issue related with jetpack compose desktop
I'm using Koin
and it seems that preview is not working because can't find the viewmodel, which is injected in the parameter of the composable
well I tryed extracting it from the constructor and still gives an error, but now Fleet doesn't tell which one
I think Fleet is still not working correctly, also seems to be much more slower
I think I'm coming back to AS