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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
use *;
/*
fn main() {
let app = Application::new(|state, window| {
let window_flex_direction = FlexDirection::Row;
window.set_title("Align Items");
// .set_background_color(state, Color::white())
// .set_flex_direction(state, window_flex_direction);
let container_flex_direction = match window_flex_direction {
FlexDirection::Column | FlexDirection::ColumnReverse => FlexDirection::Row,
FlexDirection::Row | FlexDirection::RowReverse => FlexDirection::Column,
};
// Flex Start
let container = Element::new().build(state, window.entity(), |builder| {
builder
.set_flex_grow(1.0)
.set_background_color(Color::rgb(50, 50, 50))
.set_justify_content(JustifyContent::Center)
.set_align_items(AlignItems::FlexStart)
.set_flex_direction(container_flex_direction)
});
Element::new().build(state, container, |builder| {
builder
.set_width(Units::Pixels(30.0))
.set_height(Units::Pixels(30.0))
.set_background_color(Color::rgb(50, 50, 120))
});
Element::new().build(state, container, |builder| {
builder
.set_width(Units::Pixels(30.0))
.set_height(Units::Pixels(30.0))
.set_background_color(Color::rgb(50, 50, 160))
});
Element::new().build(state, container, |builder| {
builder
.set_width(Units::Pixels(30.0))
.set_height(Units::Pixels(30.0))
.set_background_color(Color::rgb(50, 50, 200))
});
// Flex End
let container = Element::new().build(state, window.entity(), |builder| {
builder
.set_flex_grow(1.0)
.set_background_color(Color::rgb(70, 70, 70))
.set_justify_content(JustifyContent::Center)
.set_align_items(AlignItems::FlexEnd)
.set_flex_direction(container_flex_direction)
});
Element::new().build(state, container, |builder| {
builder
.set_width(Units::Pixels(30.0))
.set_height(Units::Pixels(30.0))
.set_background_color(Color::rgb(50, 120, 50))
});
Element::new().build(state, container, |builder| {
builder
.set_width(Units::Pixels(30.0))
.set_height(Units::Pixels(30.0))
.set_background_color(Color::rgb(50, 160, 50))
});
Element::new().build(state, container, |builder| {
builder
.set_width(Units::Pixels(30.0))
.set_height(Units::Pixels(30.0))
.set_background_color(Color::rgb(50, 200, 50))
});
// Center
let container = Element::new().build(state, window.entity(), |builder| {
builder
.set_flex_grow(1.0)
.set_background_color(Color::rgb(50, 50, 50))
.set_justify_content(JustifyContent::Center)
.set_align_items(AlignItems::Center)
.set_flex_direction(container_flex_direction)
});
Element::new().build(state, container, |builder| {
builder
.set_width(Units::Pixels(30.0))
.set_height(Units::Pixels(30.0))
.set_background_color(Color::rgb(120, 50, 50))
});
Element::new().build(state, container, |builder| {
builder
.set_width(Units::Pixels(30.0))
.set_height(Units::Pixels(30.0))
.set_background_color(Color::rgb(160, 50, 50))
});
Element::new().build(state, container, |builder| {
builder
.set_width(Units::Pixels(30.0))
.set_height(Units::Pixels(30.0))
.set_background_color(Color::rgb(200, 50, 50))
});
// Stretch
let container = Element::new().build(state, window.entity(), |builder| {
builder
.set_flex_grow(1.0)
.set_background_color(Color::rgb(70, 70, 70))
.set_justify_content(JustifyContent::Center)
.set_align_items(AlignItems::Stretch)
.set_flex_direction(container_flex_direction)
});
Element::new().build(state, container, |builder| {
builder
.set_flex_basis(Units::Pixels(30.0))
.set_background_color(Color::rgb(120, 120, 50))
});
Element::new().build(state, container, |builder| {
builder
.set_flex_basis(Units::Pixels(30.0))
.set_background_color(Color::rgb(160, 120, 50))
});
Element::new().build(state, container, |builder| {
builder
.set_flex_basis(Units::Pixels(30.0))
.set_background_color(Color::rgb(200, 120, 50))
});
//win_desc.with_title("Align Items")
});
app.run();
}
*/