You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@Composable
@Preview
funApp() {
var text by remember { mutableStateOf("Hello, World!") }
MaterialTheme {
Button(onClick = {
text ="Hello, Desktop!"
}) {
Text(text)
}
}
}
The preview button
Will only show up when the import of @Preview is from androidx.compose.desktop.ui.tooling.preview.Preview and not org.jetbrains.compose.ui.tooling.preview.Preview (the compose desktop template that is a little bit outdated is using androidx.compose.desktop.ui.tooling.preview.Preview and not org.jetbrains.compose.ui.tooling.preview.Preview (which is the default when using (kmp.jetbrains.com to create the compose desktop project)
Make sure to replace import androidx.compose.desktop.ui.tooling.preview.Preview with import org.jetbrains.compose.ui.tooling.preview.Preview or try out both
You will notice the preview button only shows up when using import androidx.compose.desktop.ui.tooling.preview.Preview and not the new one from Jetbrains (which is designed for Compose Multiplatform and I believe it's used in Fleet IDE)
Expected behavior
Compose desktop and Compose multiplatform have a great future, maybe we should make the process less confusing and exclude anything related to Android. this doesn't require any breaking changes, we can support both and use the one from JetBrains as a default
Screenshots
If applicable, add screenshots to help explain your problem.
The preview button doesn't show up:
It shows up after using Preview annotation from Androidx Import:
Additional information
Not related to the issue, but maybe you should consider making the process easier since now we have multiple ways and places to create a Compose Desktop or Compose Multiplatform project, and each one has a default code that has advantages over the other, creating a CLI and add support for it in IDE would make the process much easier, like other frameworks (Flutter, React, etc)) which makes it more beginner-friendly and less confusing, I even created a very quick CLI utility (kmp-cli) just so I use it for creating Compose projects quickly
Thank you.
The text was updated successfully, but these errors were encountered:
EchoEllet
changed the title
Compose Multiplatform IDE Plugin doesn't show when using Jetbrains Preview annotation
Compose Desktop IDE Plugin doesn't show when using Jetbrains Preview annotation
May 20, 2024
… annotation (JetBrains#4839)
Allows desktop preview to work with org.jetbrains.compose.ui.tooling.preview.Preview annotation in addition to desktop preview annotation. That allows using preview in common code (JetBrains#2045), though only with desktop target enabled
FixesJetBrains#4839, JetBrains#2045
Describe the bug
When creating a project in Kotlin Multiplatform Wizard (since Compose Multiplatform Desktop template is a little bit outdated, doesn't use Gradle Version catalog by default for example)
When using Compose Multiplatform IDE Support (which is for Compose desktop but the name indicates it's for Compose Multiplatform)
Let's say you have the following code snippet:
The preview button
Will only show up when the import of
@Preview
is fromandroidx.compose.desktop.ui.tooling.preview.Preview
and notorg.jetbrains.compose.ui.tooling.preview.Preview
(the compose desktop template that is a little bit outdated is usingandroidx.compose.desktop.ui.tooling.preview.Preview
and notorg.jetbrains.compose.ui.tooling.preview.Preview
(which is the default when using (kmp.jetbrains.com to create the compose desktop project)Affected platforms
Versions
To Reproduce
Steps to reproduce the behavior:
import androidx.compose.desktop.ui.tooling.preview.Preview
withimport org.jetbrains.compose.ui.tooling.preview.Preview
or try out bothimport androidx.compose.desktop.ui.tooling.preview.Preview
and not the new one from Jetbrains (which is designed for Compose Multiplatform and I believe it's used in Fleet IDE)Expected behavior
Compose desktop and Compose multiplatform have a great future, maybe we should make the process less confusing and exclude anything related to Android. this doesn't require any breaking changes, we can support both and use the one from JetBrains as a default
Screenshots
If applicable, add screenshots to help explain your problem.
The preview button doesn't show up:
It shows up after using
Preview
annotation from Androidx Import:Additional information
Not related to the issue, but maybe you should consider making the process easier since now we have multiple ways and places to create a Compose Desktop or Compose Multiplatform project, and each one has a default code that has advantages over the other, creating a CLI and add support for it in IDE would make the process much easier, like other frameworks (Flutter, React, etc)) which makes it more beginner-friendly and less confusing, I even created a very quick CLI utility (kmp-cli) just so I use it for creating Compose projects quickly
Thank you.
The text was updated successfully, but these errors were encountered: