1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
use makara::prelude::*;
use bevy::prelude::*;
fn main() {
App::new()
.add_plugins(MakaraPlugin::default())
.add_systems(Startup, setup)
.run();
}
fn setup(mut commands: Commands) {
commands.spawn(
root_!(
background_color: Color::srgb(0.1, 0.1, 0.2),
class: "justify-center align-center";
[
column_!(
width: percent(90),
height: percent(90),
background_color: Color::WHITE,
class: "justify-start align-center p-4";
[
// Title
text_!(
"Container Alignment Classes",
font_size: 28.0,
color: Color::srgb(0.2, 0.2, 0.8),
class: "mb-4"
),
text_!(
"Alignment classes work on container widgets: root, row, column, scroll",
font_size: 16.0,
color: Color::srgb(0.5, 0.5, 0.5),
class: "mb-4"
),
// Row with justify-center
row_!(
width: percent(100),
height: px(60),
background_color: Color::srgb(0.95, 0.95, 1.0),
class: "justify-center align-center mb-3";
[
text_!("row with justify-center", color: Color::srgb(0.3, 0.3, 0.7))
]
),
// Row with justify-between
row_!(
width: percent(100),
height: px(60),
background_color: Color::srgb(0.95, 1.0, 0.95),
class: "justify-between align-center p-3 mb-3";
[
text_!("Left", color: Color::srgb(0.2, 0.6, 0.2)),
text_!("justify-between", color: Color::srgb(0.2, 0.6, 0.2)),
text_!("Right", color: Color::srgb(0.2, 0.6, 0.2))
]
),
// Column with align-center
column_!(
width: percent(100),
height: px(120),
background_color: Color::srgb(1.0, 0.95, 0.95),
class: "justify-center align-center p-3 mb-3";
[
text_!("column with align-center", color: Color::srgb(0.7, 0.2, 0.2)),
text_!("Content is centered", color: Color::srgb(0.5, 0.5, 0.5))
]
),
// Scroll container example
scroll_!(
width: percent(100),
height: px(100),
background_color: Color::srgb(0.95, 0.95, 0.95),
class: "justify-center align-center p-2";
[
column_!(
class: "justify-start align-center";
[
text_!("scroll container with alignment", color: Color::srgb(0.4, 0.4, 0.4)),
text_!("Line 2", color: Color::srgb(0.4, 0.4, 0.4)),
text_!("Line 3", color: Color::srgb(0.4, 0.4, 0.4)),
text_!("Line 4", color: Color::srgb(0.4, 0.4, 0.4)),
text_!("Line 5", color: Color::srgb(0.4, 0.4, 0.4))
]
)
]
)
]
)
]
)
);
}