compose-multiplatform icon indicating copy to clipboard operation
compose-multiplatform copied to clipboard

Add the ability to "pack" a window while allowing its content to match the window size

Open m-sasha opened this issue 3 years ago • 1 comments

Due to how Compose layouts work, together with the way WindowState(size=DpSize.Unspecified) is implemented, it's not currently possible to say "I want to size the window to its preferred size, but when the user resizes it, the content should match the window size. The latter requires the content to be fillMaxSize(), but this causes size=DpSize.Unspecified to set the window size to match the screen.

The solution can be to have ComposeLayer.preferredSize() return the min intrinsic size of the content.

We would also need to design an API how the user can specify this behavior, unless we want to just replace the current size=DpSize.Unspecified behavior.

m-sasha avatar Mar 27 '23 07:03 m-sasha

A proof-of-concept that just replaces the size=DpSize.Unspecified functionality:

0001-WIP-Report-the-ComposeLayer-s-preferred-size-to-be-t.patch

m-sasha avatar Mar 27 '23 12:03 m-sasha

Related: https://github.com/JetBrains/compose-multiplatform-core/pull/884

@Walingar FYI

m-sasha avatar Nov 16 '23 06:11 m-sasha