Documentation ¶
Overview ¶
Package layout defines the various layouts available to Fyne apps.
Index ¶
- func NewAdaptiveGridLayout(rowcols int) fyne.Layout
- func NewBorderLayout(top, bottom, left, right fyne.CanvasObject) fyne.Layout
- func NewCenterLayout() fyne.Layout
- func NewCustomPaddedHBoxLayout(padding float32) fyne.Layout
- func NewCustomPaddedLayout(padTop, padBottom, padLeft, padRight float32) fyne.Layout
- func NewCustomPaddedVBoxLayout(padding float32) fyne.Layout
- func NewFormLayout() fyne.Layout
- func NewGridLayout(cols int) fyne.Layout
- func NewGridLayoutWithColumns(cols int) fyne.Layout
- func NewGridLayoutWithRows(rows int) fyne.Layout
- func NewGridWrapLayout(size fyne.Size) fyne.Layout
- func NewHBoxLayout() fyne.Layout
- func NewMaxLayout() fyne.Layoutdeprecated
- func NewPaddedLayout() fyne.Layout
- func NewSpacer() fyne.CanvasObject
- func NewStackLayout() fyne.Layout
- func NewVBoxLayout() fyne.Layout
- type CustomPaddedLayout
- type Spacer
- func (s *Spacer) ExpandHorizontal() bool
- func (s *Spacer) ExpandVertical() bool
- func (s *Spacer) Hide()
- func (s *Spacer) MinSize() fyne.Size
- func (s *Spacer) Move(pos fyne.Position)
- func (s *Spacer) Position() fyne.Position
- func (s *Spacer) Refresh()
- func (s *Spacer) Resize(size fyne.Size)
- func (s *Spacer) Show()
- func (s *Spacer) Size() fyne.Size
- func (s *Spacer) Visible() bool
- type SpacerObject
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewAdaptiveGridLayout ¶
NewAdaptiveGridLayout returns a new grid layout which uses columns when horizontal but rows when vertical.
func NewBorderLayout ¶
func NewBorderLayout(top, bottom, left, right fyne.CanvasObject) fyne.Layout
NewBorderLayout creates a new BorderLayout instance with top, bottom, left and right objects set. All other items in the container will fill the centre space
func NewCenterLayout ¶
NewCenterLayout creates a new CenterLayout instance
func NewCustomPaddedHBoxLayout ¶
NewCustomPaddedHBoxLayout returns a layout similar to HBoxLayout that uses a custom amount of padding in between objects instead of the theme.Padding value.
Since: 2.5
func NewCustomPaddedLayout ¶
NewCustomPaddedLayout creates a new CustomPaddedLayout instance with the specified paddings.
Since: 2.5
func NewCustomPaddedVBoxLayout ¶
NewCustomPaddedVBoxLayout returns a layout similar to VBoxLayout that uses a custom amount of padding in between objects instead of the theme.Padding value.
Since: 2.5
func NewFormLayout ¶
NewFormLayout returns a new FormLayout instance
func NewGridLayout ¶
NewGridLayout returns a grid layout arranged in a specified number of columns. The number of rows will depend on how many children are in the container that uses this layout.
func NewGridLayoutWithColumns ¶
NewGridLayoutWithColumns returns a new grid layout that specifies a column count and wrap to new rows when needed.
func NewGridLayoutWithRows ¶
NewGridLayoutWithRows returns a new grid layout that specifies a row count that creates new rows as required.
func NewGridWrapLayout ¶
NewGridWrapLayout returns a new GridWrapLayout instance
func NewHBoxLayout ¶
NewHBoxLayout returns a horizontal box layout for stacking a number of child canvas objects or widgets left to right. The objects are always displayed at their horizontal MinSize. Use a different layout if the objects are intended to be larger than their horizontal MinSize.
func NewMaxLayout
deprecated
func NewSpacer ¶
func NewSpacer() fyne.CanvasObject
NewSpacer returns a spacer object which can fill vertical and horizontal space. This is primarily used with a box layout.
func NewStackLayout ¶
NewStackLayout returns a new StackLayout instance. Objects are stacked on top of each other with later objects on top of those before. Having only a single object has no impact as CanvasObjects will fill the available space even without a Stack.
Since: 2.4
func NewVBoxLayout ¶
NewVBoxLayout returns a vertical box layout for stacking a number of child canvas objects or widgets top to bottom. The objects are always displayed at their vertical MinSize. Use a different layout if the objects are intended to be larger than their vertical MinSize.
Types ¶
type CustomPaddedLayout ¶
type CustomPaddedLayout struct { TopPadding float32 BottomPadding float32 LeftPadding float32 RightPadding float32 }
CustomPaddedLayout is a layout similar to PaddedLayout, but uses custom values for padding on each side, rather than the theme padding value.
Since: 2.5
func (CustomPaddedLayout) Layout ¶
func (c CustomPaddedLayout) Layout(objects []fyne.CanvasObject, size fyne.Size)
Layout is called to pack all child objects into a specified size. For CustomPaddedLayout this sets all children to the full size passed minus the given paddings all around.
func (CustomPaddedLayout) MinSize ¶
func (c CustomPaddedLayout) MinSize(objects []fyne.CanvasObject) (min fyne.Size)
MinSize finds the smallest size that satisfies all the child objects. For CustomPaddedLayout this is determined simply as the MinSize of the largest child plus the given paddings all around.
type Spacer ¶
type Spacer struct { FixHorizontal bool FixVertical bool // contains filtered or unexported fields }
Spacer is any simple object that can be used in a box layout to space out child objects
func (*Spacer) ExpandHorizontal ¶
ExpandHorizontal returns whether or not this spacer expands on the horizontal axis
func (*Spacer) ExpandVertical ¶
ExpandVertical returns whether or not this spacer expands on the vertical axis
func (*Spacer) Refresh ¶
func (s *Spacer) Refresh()
Refresh does nothing for a spacer but is part of the CanvasObject definition
func (*Spacer) Show ¶
func (s *Spacer) Show()
Show sets the Spacer to be part of the layout calculations
type SpacerObject ¶
SpacerObject is any object that can be used to space out child objects