Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce variety of Preview annotations #4869

Closed
igordmn opened this issue May 24, 2024 · 9 comments
Closed

Reduce variety of Preview annotations #4869

igordmn opened this issue May 24, 2024 · 9 comments
Labels
enhancement New feature or request ide IDE related issue p:high High priority preview

Comments

@igordmn
Copy link
Collaborator

igordmn commented May 24, 2024

We have 3 Previews:

  • androidx.compose.ui.tooling.preview.Preview
    • for androidMain
    • supported in Android Studio/IDEA
    • build.gradle should have implementation(compose.preview)
  • androidx.compose.desktop.ui.tooling.preview.Preview
    • for desktopMain
    • supported in Android Studio/IDEA
    • needed a separated installed IDE plugin
    • is available by default, no need extra lines in build.gradle
  • org.jetbrains.compose.ui.tooling.preview.Preview
    • for commonMain/androidMain/desktopMain
    • supported by Fleet
    • build.gradle should have implementation(compose.components.uiToolingPreview)

We should reduce the count, and make consistent guidelines/templates.

@igordmn igordmn added enhancement New feature or request ide IDE related issue p:high High priority labels May 24, 2024
@igordmn
Copy link
Collaborator Author

igordmn commented May 24, 2024

Sub-issue: project created by kmp.jetbrains.com doesn't support Preview in IDEA/Android Studio #4839

@EchoEllet
Copy link

EchoEllet commented May 24, 2024

I agree that we have to either use the Android one for compability or the one from Jetbrains compose multiplatform as it's more future proof.

@akexorcist
Copy link

Preview an UI in commonMain on IntelliJ IDEA that is what I want.

@igordmn igordmn changed the title Reduce variety of Preview Reduce variety of Preview annotations May 25, 2024
@malbanese
Copy link

+1 Getting multiplatform compose previews to work in different places is currently a hassle.

@igordmn
Copy link
Collaborator Author

igordmn commented Jun 3, 2024

A report in Kotlin IDEA plugin tracker: https://youtrack.jetbrains.com/issue/KTIJ-30072

@malbanese
Copy link

For anyone else who finds this, I've found a solution that fits my needs while waiting for better preview support in Compose Multiplatform and Android Studio.

I was able to use the new Compose Preview Screenshot Testing library inside fully KMP / Compose multiplatform modules.

Previews work inside Android Studio under the proper package, and this (mostly) solves my screenshot testing needs as well. Obviously there are some requirements like putting previews in the screenshotTesting source directory, require an Android target with AGP 8.5.0, and only being able to pull from the common/android sources.

Here's the Gradle convention plugin I'm using to apply to the relevant modules:
https://gist.github.com/malbanese/6f015e0390ee767c4bc0acb87f697755

@igordmn
Copy link
Collaborator Author

igordmn commented Jul 8, 2024

Preview an UI in commonMain on IntelliJ IDEA that is what I want.

Let's move this into a separate task: #5078

@igordmn
Copy link
Collaborator Author

igordmn commented Jul 8, 2024

Parent task: #2045

@okushnikov
Copy link
Collaborator

Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request ide IDE related issue p:high High priority preview
Projects
None yet
Development

No branches or pull requests

5 participants