axis:=layout.Vertical// chosen at run time, as by the width of the windowreturnbasic.Flex{Axis:axis,Size:layout.MainMin,Spacing:theme.Space8,Children:[]core.Widget{tile("Flex",120,32),tile("picks its axis",160,32),tile("at run time",140,32),}}
basic.SizedBox{Width:520,Child:basic.Row{Spacing:theme.Space8,Children:[]core.Widget{tile("Fixed",80,40),basic.Expanded{Child:tile("Expanded takes the rest",0,40)},basic.Expanded{Flex:2,Child:tile("Flex 2",0,40)},}}}
basic.Row{Size:layout.MainMin,Spacing:theme.Space8,Cross:layout.CrossStart,Children:[]core.Widget{basic.SizedBox{Width:140,Height:48,Child:tile("140 by 48",0,0)},basic.SizedBox{Width:24},// an empty gapbasic.SizedBox{Width:80,Height:80,Child:tile("80 by 80",0,0)},}}
basic.Column{Size:layout.MainMin,Cross:layout.CrossStart,Spacing:theme.Space8,Children:[]core.Widget{basic.ConstrainedBox{MinWidth:160,Child:control.Button{Label:"OK",OnPress:func(){}}},basic.ConstrainedBox{MaxWidth:200,Child:basic.Text{Content:"MaxWidth makes a long line of text wrap inside 200 pixels."}},}}
themed(func(th*theme.Theme)core.Widget{returnbasic.DecoratedBox{Decoration:layout.Decoration{Color:th.Color.Card,Radius:th.Radius.Group,Border:&paint.Stroke{Width:1,Color:th.Color.Hair}},Child:basic.Padding{Insets:geom.All(theme.Space16),Child:basic.Text{Content:"DecoratedBox paints behind its child"}},}})
lines:=make([]core.Widget,12)fori:=rangelines{lines[i]=basic.Text{Content:"Line "+strconv.Itoa(i+1)+" of a column taller than its box"}}returnbasic.SizedBox{Width:300,Height:140,Child:basic.Scroll{Child:basic.Column{Size:layout.MainMin,Cross:layout.CrossStart,Spacing:theme.Space4,Children:lines,}}}
panes:=basic.LayoutBuilder{Content:func(_core.BuildContext,clayout.Constraints)core.Widget{ifc.MaxW<300{// narrow: one above the otherreturnbasic.Column{Size:layout.MainMin,Spacing:theme.Space8,Children:[]core.Widget{tile("List",c.MaxW,40),tile("Detail",c.MaxW,40),}}}returnbasic.Row{Size:layout.MainMin,Spacing:theme.Space8,Children:[]core.Widget{tile("List",120,88),tile("Detail",c.MaxW-120-theme.Space8,88),}}}}returnbasic.Row{Size:layout.MainMin,Spacing:theme.Space16,Cross:layout.CrossStart,Children:[]core.Widget{basic.SizedBox{Width:160,Child:panes},basic.SizedBox{Width:320,Child:panes},}}
// box is a 200 by 120 frame with the largest rectangle of ratio in it.box:=func(ratiofloat32,labelstring)core.Widget{returnbasic.Container{Width:200,Height:120,Padding:geom.All(theme.Space8),Radius:th.Radius.Control,Border:paint.Stroke{Width:1,Color:th.Color.Hair},Child:basic.Center{Child:basic.AspectRatio{Ratio:ratio,Child:tile(label,0,0)}},}}returnbasic.Row{Size:layout.MainMin,Spacing:theme.Space16,Children:[]core.Widget{box(16.0/9,"16:9"),// as wide as the framebox(1,"1:1"),// as tall as the frame}}