slint-ui / slint

Slint is a declarative GUI toolkit to build native user interfaces for Rust, C++, or JavaScript apps.
https://slint.dev
Other
16.93k stars 565 forks source link

Nested Flickables don't work #1349

Closed MattMoszczynski closed 1 year ago

MattMoszczynski commented 2 years ago

I experienced an issue that if we create a nested Flickable (one Flickable inside another), the inner Flickable won't scroll. My current implementation of the code: https://github.com/Project-Trains/launcher/blob/master/src/ui/market.slint.

Here's a simplified example:

Item := Rectangle {
    vertical-stretch: 1;
    width: 300phx;

    Rectangle { 
        height: parent.height;
        width: parent.width - 20phx;
        border-radius: 20phx;
        background: #161a1f;
        drop-shadow-color: #0000006e;
        drop-shadow-blur: 12phx;
        clip: true;

        Image {
            source: @image-url("../assets/devlog.jpg");
            image-fit: cover;
            height: parent.height;
            width: parent.width;
        }
    }
}

Test := Rectangle {
    vertical-stretch: 1;
    horizontal-stretch: 1;
    clip: true;

    Flickable {
        interactive: false;

        VerticalLayout {                

            Flickable {
                interactive: false;
                height: 180phx;

                HorizontalLayout {
                    clip: true;

                    Item {}
                    Item {}
                    Item {}
                    Item {}
                    Item {}
                    Item {}
                    Item {}
                    Item {}
                    Item {}
                    Item {}
                }
            }
        }
    }
}
ogoffart commented 2 years ago

Thanks for your bug report

I cannot reproduce the problem. In your example, you have interactive:false; on your Flickable, which of course means it doesn't flick. If i remove that, then it flicks correctly (see live editor )

Is there another way to reproduce the problem?

ogoffart commented 1 year ago

I'm closing this issue since i cannot reproduce it. Maybe this was caused by interactive:false. Feel free to comment on it if you want it to be re-opened.