类型 GridSpec

API 文档由 Go 源码生成,内容为英文。

type GridSpec struct {
	MinCellWidth float32
	CellHeight   float32
	Gap          float32
}

GridSpec describes a wrapping grid of equal cells. MinCellWidth is the narrowest a cell may become, not its size: the column count is the most cells of at least that width that fit, and the cells then stretch to fill the container exactly, so the grid follows its container instead of sitting at a fixed size in one corner of it.

方法

Columns#

func (spec GridSpec) Columns(width float32) int

Columns returns the column count for a container width. It is never below one: a container narrower than MinCellWidth gets a single, narrower column rather than overflowing.

Height#

func (spec GridSpec) Height(width float32, count int) float32

Height returns the height of count cells at a container width, without a trailing gap.

Rows#

func (spec GridSpec) Rows(width float32, count int) int

Rows returns the row count needed for count cells at a container width.