fix: Use flexbox helpers

This commit is contained in:
demenik
2025-11-28 13:15:14 +01:00
parent 885bd2aeb0
commit 9a1e7cb95a
3 changed files with 6 additions and 13 deletions

View File

@@ -9,9 +9,7 @@ pub fn spawn_load_popup(commands: &mut Commands) {
position_type: PositionType::Absolute, position_type: PositionType::Absolute,
width: percent(100), width: percent(100),
height: percent(100), height: percent(100),
justify_content: JustifyContent::Center, ..Node::center()
align_items: AlignItems::Center,
..default()
}, },
ZIndex(1), ZIndex(1),
BackgroundColor(Color::srgba(0.0, 0.0, 0.0, 0.8)), BackgroundColor(Color::srgba(0.0, 0.0, 0.0, 0.8)),
@@ -22,13 +20,11 @@ pub fn spawn_load_popup(commands: &mut Commands) {
Node { Node {
width: px(600.0), width: px(600.0),
height: px(500.0), height: px(500.0),
flex_direction: FlexDirection::Column,
align_items: AlignItems::Center,
padding: UiRect::all(px(20.0)), padding: UiRect::all(px(20.0)),
..default() ..Node::vstack(px(10))
}, },
BackgroundColor(Color::srgb(0.2, 0.2, 0.2)), BackgroundColor(Color::srgb(0.2, 0.2, 0.2)),
BorderRadius::all(Val::Px(10.0)), BorderRadius::all(px(10.0)),
)) ))
.with_children(|parent| { .with_children(|parent| {
parent.spawn(( parent.spawn((
@@ -79,12 +75,10 @@ pub fn spawn_load_popup(commands: &mut Commands) {
Node { Node {
width: percent(100), width: percent(100),
height: px(80), height: px(80),
justify_content: JustifyContent::Center,
align_items: AlignItems::Center,
flex_direction: FlexDirection::Row, flex_direction: FlexDirection::Row,
column_gap: px(10.0), column_gap: px(10.0),
padding: UiRect::horizontal(px(10.0)), padding: UiRect::horizontal(px(10.0)),
..default() ..Node::center()
}, },
BackgroundColor(ButtonVariant::Secondary.normal_background()), BackgroundColor(ButtonVariant::Secondary.normal_background()),
BorderRadius::all(px(10)), BorderRadius::all(px(10)),

View File

@@ -20,11 +20,9 @@ fn setup(mut commands: Commands) {
Node { Node {
width: percent(100), width: percent(100),
height: percent(100), height: percent(100),
justify_content: JustifyContent::Center,
align_items: AlignItems::Center,
flex_direction: FlexDirection::Column, flex_direction: FlexDirection::Column,
row_gap: px(10), row_gap: px(10),
..default() ..Node::center()
}, },
children![ children![
( (

View File

@@ -2,3 +2,4 @@ pub mod button;
pub mod flexbox; pub mod flexbox;
pub use button::{button, pill_button}; pub use button::{button, pill_button};
pub use flexbox::Flexbox;