Documentation
¶
Index ¶
- Constants
- type Box
- type BoxStyle
- func (b *BoxStyle) Flex(grow float64) *BoxStyle
- func (b *BoxStyle) FlexAuto(basis int) *BoxStyle
- func (b *BoxStyle) FlexCustom(grow float64, shrink float64, basis int) *BoxStyle
- func (b *BoxStyle) FlexDefault() *BoxStyle
- func (b *BoxStyle) FlexNone(basis int) *BoxStyle
- func (b *BoxStyle) MaxSize(maxSize int) *BoxStyle
- func (b *BoxStyle) MinSize(minSize int) *BoxStyle
- type Container
- type Direction
Constants ¶
const None = 0
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Box ¶
Box is placed in a Container along with other boxes. On calculating flex width or height, SetSize is invoked on the Box. View is called just before rendering to get the string that need to be rendered.
type BoxStyle ¶
type BoxStyle struct {
// contains filtered or unexported fields
}
BoxStyle is used to set properties which influence the flex behaviour of a box
func (*BoxStyle) Flex ¶
Flex is expected to be the most commonly used method and only allows setting a grow value. It defaults shrink and basis to 1, 0.
func (*BoxStyle) FlexAuto ¶
FlexAuto can be used to set only the basis and defaults grow and shrink to 1, 1.
func (*BoxStyle) FlexCustom ¶
FlexCustom can be used to set all three values, grow, shrink and basis.
func (*BoxStyle) FlexDefault ¶
FlexDefault set the default value for grow, shrink and basis. The default values are 1, 1, 0. This means that the box will have no starting basis and will start from 0 size. It will then grow with a proportion of 1. Shrink will have no effect as there is no basis to start with.
func (*BoxStyle) FlexNone ¶
FlexNone can be used to set only the basis and defaults grow and shrink to 0, 0. This is a way to disable the flex behaviour on a box.
type Container ¶
type Container struct {
// contains filtered or unexported fields
}
Container holds the boxes and calculate their size when SetSize is called. The size is influenced by BoxStyle assigned to a Box
func NewContainer ¶
NewContainer create a new container with a given Direction. Direction can row or column. This influence in what direction the flex behaviour will work.
func (*Container) AddBox ¶
AddBox adds a box to the container. Pass BoxStyle to set flex properties on the box.