Giter VIP home page Giter VIP logo

Comments (19)

m-sasha avatar m-sasha commented on May 27, 2024

Can you post a reproducer? This works fine for me:

fun main() = singleWindowApplication {
    DialogWindow(
        onCloseRequest = { }
    ) {
        Text("Hello, World")
    }
}

from compose-multiplatform.

JasonTranz avatar JasonTranz commented on May 27, 2024

I just call it in composable function

@Composable
fun DialogWrapper(
    visible: Boolean,
) {
    DialogWindow(
        visible = visible,
        onCloseRequest = { }
    ) {
        Text("Hello, World")
    }
}

from compose-multiplatform.

m-sasha avatar m-sasha commented on May 27, 2024

Please provide a complete, working reproduction of the bug. The full source code...

from compose-multiplatform.

m-sasha avatar m-sasha commented on May 27, 2024

What environment are you running this in? I see com.intellij.ide classes in the stack trace.

Are you writing an IDEA plugin?

from compose-multiplatform.

JasonTranz avatar JasonTranz commented on May 27, 2024

Correct. Now, I'm working to write the IDEA plugin through the Compose Desktop & Jewel library.

As I mentioned before, I just call a simple DialogWindow in compose view and an exception happens.

from compose-multiplatform.

m-sasha avatar m-sasha commented on May 27, 2024

I couldn't reproduce it.

Can you please share what’s runtime and VM, OS version do you use during development? You can do that by invoking action “About” and put its output here.

In my case I tried with current state of Jewel project (running samples:ide-plugin:runIde configuration):

IntelliJ IDEA 2024.1 (Community Edition)
Build #IC-241.14494.240, built on March 28, 2024
Runtime version: 17.0.9+7-b1087.7 aarch64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 14.0

image (9)

from compose-multiplatform.

JasonTranz avatar JasonTranz commented on May 27, 2024

Hi @m-sasha please see the video here:
https://quangtrungcollege-my.sharepoint.com/:v:/g/personal/huutq98_ms365vip_com/EWiCIP-mSENLr7y3iScNG3AB9L6MTr4nic3nVIYAJ4qpIQ?e=ZBT7TW

from compose-multiplatform.

JasonTranz avatar JasonTranz commented on May 27, 2024
image

My OS: macOS 14.4.1
Jewel: org.jetbrains.jewel:jewel-ide-laf-bridge-232:0.15.2
Compose-Desktop: 1.6.10-dev1561
Kotlin: 1.9.21

from compose-multiplatform.

m-sasha avatar m-sasha commented on May 27, 2024

Can you try with the latest (or at least 2024.1) version of IDEA?

from compose-multiplatform.

JasonTranz avatar JasonTranz commented on May 27, 2024

Can you try with the latest (or at least 2024.1) version of IDEA?

Yup, my current IDE is 2024.1. But my IDE plugin project support starts from v2023.3. If the exception happens on 2023.3 the error dialog will be displayed, right?

Can you set the props in the gradle.properties to try reproduce

pluginSinceBuild = 222.*
pluginUntilBuild = 233.*

platformType = IC
platformVersion = 2023.3
pluginVerifierIdeVersions = 2023.3

from compose-multiplatform.

m-sasha avatar m-sasha commented on May 27, 2024

If the error is due to a bug in an older version of IDEA, we're not going to be able to fix it, unfortunately.

from compose-multiplatform.

JasonTranz avatar JasonTranz commented on May 27, 2024

Alright, I will try again in 2024.1.

from compose-multiplatform.

m-sasha avatar m-sasha commented on May 27, 2024

Can you also check what happens if you open a regular java.awt.Dialog from the same place?

from compose-multiplatform.

JasonTranz avatar JasonTranz commented on May 27, 2024

It seems I don't see an error dialog when installing the plugin from disk on 2023.3.6 & 2024.1.

from compose-multiplatform.

JasonTranz avatar JasonTranz commented on May 27, 2024

Hi @m-sasha , I know this is not relevant, but I have a quick question about VerticalScrollbar. When I use it in LazyColumn via LazyListState, when I scroll their progress height increases/decreases abnormally. This doesn't happen on Column using verticalScrollState, but I need to know if it is a feature or bug to create/report.

I'm stuck with this for 2 days and trying to find out the work around but I can't. If I go back to Column and use verticalScroll it works perfectly, but I can't handle LazyLoad (it is related to performance, scrollbar index doesn't reload progress when adding more items to the top, etc.).

You can try this code below:

import androidx.compose.foundation.VerticalScrollbar
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.foundation.lazy.rememberLazyListState
import androidx.compose.foundation.rememberScrollbarAdapter
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.graphicsLayer
import androidx.compose.ui.unit.dp
import kotlin.random.Random

@Composable
fun VerticalScrollbarUsage() = Box {
    val state = rememberLazyListState()
    val itemCount = 100
    val heights = remember {
        val random = Random(10)
        (0 until itemCount).map { random.nextInt(0, 2000) }
    }

    LazyColumn(Modifier.graphicsLayer(alpha = 0.5f), state = state) {
        items((0 until itemCount).toList()) { i ->
            val itemHeight = 20.dp + 20.dp + heights[i].dp
            Text(i.toString(), Modifier.graphicsLayer(alpha = 0.5f).height(itemHeight))
        }
    }

    VerticalScrollbar(
        rememberScrollbarAdapter(state),
        Modifier.align(Alignment.CenterEnd)
    )
}

from compose-multiplatform.

m-sasha avatar m-sasha commented on May 27, 2024

If you mean that the size of the scrollbar changes as you scroll, that's expected if the items in the list are of varying sizes.

In a LazyColumn, only the visible items are actually created, so the scrollbar can't know the "real" offset or the full height of the column (the sum of heights of all the elements). Instead it uses a heuristic to estimate these values. If the items have wildly different sizes, the heuristic will be wrong.

from compose-multiplatform.

JasonTranz avatar JasonTranz commented on May 27, 2024

If you mean that the size of the scrollbar changes as you scroll, that's expected if the items in the list are of varying sizes.

In a LazyColumn, only the visible items are actually created, so the scrollbar can't know the "real" offset or the full height of the column (the sum of heights of all the elements). Instead it uses a heuristic to estimate these values. If the items have wildly different sizes, the heuristic will be wrong.

Yeah, I know how LazyList works but is there any way to improve this, because the scrollbar UX is quite bad in case the items are different in height from each other?

from compose-multiplatform.

m-sasha avatar m-sasha commented on May 27, 2024

Unfortunately no.

from compose-multiplatform.

JasonTranz avatar JasonTranz commented on May 27, 2024

Thanks for your support, Regarding the issue I mentioned before it seems not to happen on the production build. If I'm facing with this in the future, I will re-create the ticket. You can close it now.

from compose-multiplatform.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.