diff options
Diffstat (limited to 'lib/luavgl/examples/flexLayout.lua')
| -rw-r--r-- | lib/luavgl/examples/flexLayout.lua | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/lib/luavgl/examples/flexLayout.lua b/lib/luavgl/examples/flexLayout.lua new file mode 100644 index 00000000..afafa5c8 --- /dev/null +++ b/lib/luavgl/examples/flexLayout.lua @@ -0,0 +1,27 @@ +local lvgl = require("lvgl") + +local root = lvgl.Object(nil, { + flex = { + flex_direction = "row", + flex_wrap = "wrap", + justify_content = "center", + align_items = "center", + align_content = "center", + }, + w = lvgl.HOR_RES(), + h = lvgl.VER_RES(), + align = lvgl.ALIGN.CENTER +}) + +for i = 1, 10 do + local item = root:Object { + w = 100, + h = lvgl.PCT(100), + } + item:clear_flag(lvgl.FLAG.SCROLLABLE) + + local label = item:Label { + text = string.format("label %d", i) + } + label:center() +end |
