102 lines
2.8 KiB
Lua
102 lines
2.8 KiB
Lua
local ScreenArea = require "lib.simple_ui.screen_area"
|
|
local Center = require "lib.simple_ui.center"
|
|
local Placeholder = require "lib.simple_ui.placeholder"
|
|
local Padding = require "lib.simple_ui.padding"
|
|
local Builder = require "lib.simple_ui.builder"
|
|
local Flex = require "lib.simple_ui.flex"
|
|
local SizedBox = require "lib.simple_ui.sized_box"
|
|
local SingleChildElement = require "lib.simple_ui.single_child_element"
|
|
|
|
|
|
local MyWidget = setmetatable({}, SingleChildElement)
|
|
MyWidget.__index = MyWidget
|
|
|
|
--- comment
|
|
--- @return Flex
|
|
function MyWidget:build()
|
|
return Flex:new {
|
|
key = "my_flex",
|
|
direction = "vertical",
|
|
children = {
|
|
Flex:new {
|
|
key = "inner_flex",
|
|
mainAxisAlignment = "start",
|
|
children = {
|
|
SizedBox:new {
|
|
width = 100,
|
|
height = 100,
|
|
child = Placeholder:new {}
|
|
},
|
|
|
|
SizedBox:new {
|
|
width = 100,
|
|
height = 100,
|
|
child = Placeholder:new {}
|
|
},
|
|
},
|
|
|
|
},
|
|
Flex:new {
|
|
key = "inner_flex2",
|
|
mainAxisAlignment = "center",
|
|
children = {
|
|
SizedBox:new {
|
|
width = 100,
|
|
height = 100,
|
|
child = Placeholder:new {}
|
|
},
|
|
|
|
SizedBox:new {
|
|
width = 100,
|
|
height = 100,
|
|
child = Placeholder:new {}
|
|
},
|
|
},
|
|
|
|
},
|
|
Flex:new {
|
|
key = "inner_flex3",
|
|
mainAxisAlignment = "end",
|
|
children = {
|
|
SizedBox:new {
|
|
width = 100,
|
|
height = 100,
|
|
child = Placeholder:new {}
|
|
},
|
|
|
|
SizedBox:new {
|
|
width = 100,
|
|
height = 100,
|
|
child = Placeholder:new {}
|
|
},
|
|
},
|
|
|
|
},
|
|
|
|
-- SizedBox:new {
|
|
-- width = 100,
|
|
-- height = 100,
|
|
-- child = Placeholder:new {}
|
|
-- },
|
|
|
|
-- SizedBox:new {
|
|
-- width = 100,
|
|
-- height = 100,
|
|
-- child = Placeholder:new {}
|
|
-- },
|
|
}
|
|
}
|
|
end
|
|
|
|
-- function MyWidget:layout()
|
|
-- if not self.child then return end
|
|
-- self.child.constraints = self.constraints
|
|
-- self.child:layout()
|
|
-- end
|
|
|
|
return Builder {
|
|
elementTree = ScreenArea:new {
|
|
child = MyWidget:new {}
|
|
}
|
|
}
|