Implement Lua Flex widget
There needs to be a declarative way to scale widget sizes responsively.
I'm aiming for a simpler, one-dimensional (either row or column) take on a flexbox https://css-tricks.com/snippets/css/a-guide-to-flexbox/
Something like
local windowHeaderLayout = {
type = ui.TYPE.Flex,
props = {
size = v2(300, 50),
-- horizontal (row) by default, otherwise vertical (column)
horizontal = true,
-- align the widgets along the Flex's direction. Unused if any content widgets can grow
justify = ui.ALIGNMENT.Center,
-- align the widgets perpendicular the Flex's direction.
align = ui.ALIGNMENT.Center,
},
content = ui.content {
{ -- Window header left block
type = ui.TYPE.Image,
-- ... properties of the image
external = {
grow = 1, -- can grow to take up free space
},
},
{ -- Window caption, autosized by default
type = ui.TYPE.Text,
props = {
text = getCaption(), -- some dynamic caption of unknown size
},
external = {
grow = 0, -- doesn't grow (default)
},
},
{ -- Window header right block
type = ui.TYPE.Image,
-- ... properties of the image
external = {
grow = 1, -- can grow to take up free space
},
},
},
}
Edited by jvoisin