Documentation
¶
Overview ¶
Package flexbox is the flexbox-style layout solver of the Tango self-drawn UI: Row/Column with Grow/Shrink/Basis, Gap, Padding, Margin, Align, Justify and Wrap, plus Stack (children overlap) and absolute positioning for overlays. Sizes are measured on both axes: leaves expose a Measure callback that receives the available width and height (text wraps to the width it is given).
Deliberate difference from Viva's solver: an item with Grow > 0 and no explicit Basis is distributed from a basis of 0 (CSS `flex: 1`) on both axes, so equal Grow factors give equal sizes even in a Column.
The solver is internal: the public API is the opaque layout.Option and its constructors in package ui/layout.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Node ¶
type Node struct {
Style
Children []*Node
// Measure returns the content size of a leaf given the available inner
// width and height (either may be +Inf).
Measure func(maxW, maxH float32) geom.Size
Ref any
Rect geom.Rect // output: border box relative to parent
Content geom.Size // output: size of laid-out content incl. padding
// contains filtered or unexported fields
}
Node is a layout tree node. Callers fill Style/Children/Measure, call Solve, then read Rect (relative to the parent's border box) and Content.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package flexstyle holds the layout input of a node, shared by the public option constructors (package ui/layout) and the solver (package ui/internal/flexbox).
|
Package flexstyle holds the layout input of a node, shared by the public option constructors (package ui/layout) and the solver (package ui/internal/flexbox). |