SecondHalfGames / yakui

yakui is a declarative Rust UI library for games
Apache License 2.0
230 stars 21 forks source link

Constrained box at root takes the whole space #128

Closed Uriopass closed 9 months ago

Uriopass commented 9 months ago

Not sure if a bug or not, but could be useful to anyone having the same issue. Rendering a colored box at the root takes the whole space even if constrained.

See this example:

        yakui::colored_box_container(colors::BACKGROUND_2, || {
            yakui::pad(Pad::all(8.0), || {
                yakui::text(10.0, "hi");
            });
        });

image

And as a workaround, the layout works as expected with yakui::column

        yakui::column(|| {
            yakui::colored_box_container(colors::BACKGROUND_2, || {
                yakui::pad(Pad::all(8.0), || {
                    yakui::text(10.0, "hi");
                });
            });
        });

image

Uriopass commented 9 months ago

Actually I think that's the default flutter behavior: the root is forced to screen size. See the doc example #2.