Fyne API "container"

container


import "fyne.io/fyne/v2/container"

Package container provides containers that are used to lay out and organise applications.

Usage

const (
	// ScrollBoth supports horizontal and vertical scrolling.
	ScrollBoth ScrollDirection = widget.ScrollBoth
	// ScrollHorizontalOnly specifies the scrolling should only happen left to right.
	ScrollHorizontalOnly = widget.ScrollHorizontalOnly
	// ScrollVerticalOnly specifies the scrolling should only happen top to bottom.
	ScrollVerticalOnly = widget.ScrollVerticalOnly
	// ScrollNone turns off scrolling for this container.
	//
	// Since: 2.1
	ScrollNone = widget.ScrollNone
)

Constants for valid values of ScrollDirection.

func New

func New(layout fyne.Layout, objects ...fyne.CanvasObject) *fyne.Container

New returns a new Container instance holding the specified CanvasObjects which will be laid out according to the specified Layout.

Since: 2.0

func NewAdaptiveGrid

func NewAdaptiveGrid(rowcols int, objects ...fyne.CanvasObject) *fyne.Container

NewAdaptiveGrid creates a new container with the specified objects and using the grid layout. When in a horizontal arrangement the rowcols parameter will specify the column count, when in vertical it will specify the rows. On mobile this will dynamically refresh when device is rotated.

Since: 1.4

func NewBorder

func NewBorder(top, bottom, left, right fyne.CanvasObject, objects ...fyne.CanvasObject) *fyne.Container

NewBorder creates a new container with the specified objects and using the border layout. The top, bottom, left and right parameters specify the items that should be placed around edges, the remaining elements will be in the center. Nil can be used to an edge if it should not be filled.

Since: 1.4

func NewCenter

func NewCenter(objects ...fyne.CanvasObject) *fyne.Container

NewCenter creates a new container with the specified objects centered in the available space.

Since: 1.4

func NewGridWithColumns

func NewGridWithColumns(cols int, objects ...fyne.CanvasObject) *fyne.Container

NewGridWithColumns creates a new container with the specified objects and using the grid layout with a specified number of columns. The number of rows will depend on how many children are in the container.

Since: 1.4

func NewGridWithRows

func NewGridWithRows(rows int, objects ...fyne.CanvasObject) *fyne.Container

NewGridWithRows creates a new container with the specified objects and using the grid layout with a specified number of rows. The number of columns will depend on how many children are in the container.

Since: 1.4

func NewGridWrap

func NewGridWrap(size fyne.Size, objects ...fyne.CanvasObject) *fyne.Container

NewGridWrap creates a new container with the specified objects and using the gridwrap layout. Every element will be resized to the size parameter and the content will arrange along a row and flow to a new row if the elements don’t fit.

Since: 1.4

func NewHBox

func NewHBox(objects ...fyne.CanvasObject) *fyne.Container

NewHBox creates a new container with the specified objects and using the HBox layout. The objects will be placed in the container from left to right and always displayed at their horizontal MinSize. Use a different layout if the objects are intended to be larger then their horizontal MinSize.

Since: 1.4

func NewMax

func NewMax(objects ...fyne.CanvasObject) *fyne.Container

NewMax creates a new container with the specified objects filling the available space.

Since: 1.4
Deprecated: Use container.NewStack() instead.

func NewPadded

func NewPadded(objects ...fyne.CanvasObject) *fyne.Container

NewPadded creates a new container with the specified objects inset by standard padding size.

Since: 1.4

func NewStack

func NewStack(objects ...fyne.CanvasObject) *fyne.Container

NewStack returns a new container that stacks objects on top of each other. Objects at the end of the container will be stacked on top of objects before. Having only a single object has no impact as CanvasObjects will fill the available space even without a Stack.

Since: 2.4

func NewVBox

func NewVBox(objects ...fyne.CanvasObject) *fyne.Container

NewVBox creates a new container with the specified objects and using the VBox layout. The objects will be stacked in the container from top to bottom and always displayed at their vertical MinSize. Use a different layout if the objects are intended to be larger then their vertical MinSize.

Since: 1.4

func NewWithoutLayout

func NewWithoutLayout(objects ...fyne.CanvasObject) *fyne.Container

NewWithoutLayout returns a new Container instance holding the specified CanvasObjects that are manually arranged.

Since: 2.0

types