forked from XuNeo/luavgl
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeclarative.lua
More file actions
41 lines (36 loc) · 907 Bytes
/
declarative.lua
File metadata and controls
41 lines (36 loc) · 907 Bytes
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
local lvgl = require("lvgl")
local Object = lvgl.Object
local Button = lvgl.Button
local Label = lvgl.Label
Object {
flex = {
flex_direction = "row",
flex_wrap = "wrap",
justify_content = "center",
align_items = "center",
align_content = "center",
},
w = 400,
h = 100,
align = lvgl.ALIGN.CENTER,
-- Button with label, inside a container
Object {
w = 150,
h = lvgl.PCT(80),
bg_color = "#aa0",
Button {
Label {
text = string.format("BUTTON %d", 1),
align = lvgl.ALIGN.CENTER
}
}:center()
}:clear_flag(lvgl.FLAG.SCROLLABLE),
-- Label inside a container
Object {
w = 150,
h = lvgl.PCT(80),
Label {
text = string.format("label %d", 2)
}:center()
}:clear_flag(lvgl.FLAG.SCROLLABLE)
}