package main
import (
"github.com/kjk/flex"
)
func main() {
root := flex.NewNode()
root.StyleSetWidth(500)
root.StyleSetHeight(120)
root.StyleSetFlexDirection(flex.FlexDirectionRow)
root.StyleSetPadding(flex.EdgeAll, 20)
image := flex.NewNode()
image.StyleSetWidth(80)
image.StyleSetMargin(flex.EdgeEnd, 20)
text := flex.NewNode()
text.StyleSetHeight(25)
text.StyleSetAlignSelf(flex.AlignCenter)
text.StyleSetFlexGrow(1)
root.InsertChild(image, 0)
root.InsertChild(text, 1)
flex.NodePrint(root, flex.PrintOptionsLayout|flex.PrintOptionsChildren|flex.PrintOptionsStyle)
}
>> go run main.go
<div layout="width: NaN; height: NaN; top: 0; left: 0;" style="flex-direction: ; width: 500px; height: 120px; " >
<div layout="width: NaN; height: NaN; top: 0; left: 0;" style="width: 80px; " ></div>
<div layout="width: NaN; height: NaN; top: 0; left: 0;" style="align-self: ; flex-grow: 1; height: 25px; " ></div>
</div>