SecondHalfGames / yakui

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

add spacer widget #137

Closed Uriopass closed 11 months ago

Uriopass commented 11 months ago

A spacer is no more than a expanded(|| SizedBox::shrink()) (with customizable flex)

but we can implement the widget directly as it is very simple

https://github.com/flutter/flutter/blob/78666c8dc5/packages/flutter/lib/src/widgets/spacer.dart#L58

Maybe the short-hand should be split into spacer(); and spacer_flex(u32); :shrug:

    row(|| {
        colored_box(Color::RED, [100.0, 100.0]);
        spacer(2);
        colored_box(Color::GREEN, [100.0, 100.0]);
        spacer(1);
        colored_box(Color::BLUE, [100.0, 100.0]);
    });

image

Closes #75