Documentation
¶
Overview ¶
Package layout contains community extensions for Fyne layouts
Index ¶
Constants ¶
const ( // SMALL is the smallest breakpoint (mobile vertical). SMALL responsiveBreakpoint = 576 // MEDIUM is the medium breakpoint (mobile horizontal, tablet vertical). MEDIUM responsiveBreakpoint = 768 // LARGE is the largest breakpoint (tablet horizontal, small desktop). LARGE responsiveBreakpoint = 992 // XLARGE is the largest breakpoint (large desktop). XLARGE responsiveBreakpoint = 1200 // SM is an alias for SMALL SM responsiveBreakpoint = SMALL // MD is an alias for MEDIUM MD responsiveBreakpoint = MEDIUM // LG is an alias for LARGE LG responsiveBreakpoint = LARGE // XL is an alias for XLARGE XL responsiveBreakpoint = XLARGE )
Variables ¶
This section is empty.
Functions ¶
func NewResponsiveLayout ¶
func NewResponsiveLayout(o ...fyne.CanvasObject) *fyne.Container
NewResponsiveLayout return a responsive layout that will adapt objects with the responsive rules. To configure the rule, each object could be encapsulated by a "Responsive" object.
Example:
container := NewResponsiveLayout( Responsive(label, 1, .5, .25), // 100% for small, 50% for medium, 25% for large Responsive(button, 1, .5, .25), // ... label2, // this will be placed and resized with default behaviors // => 1, 1, 1 )
func Responsive ¶
func Responsive(object fyne.CanvasObject, breakpointRatio ...float32) fyne.CanvasObject
Responsive register the object with a responsive configuration. The optional ratios must be 0 < ratio <= 1 and passed in this order:
Responsive(object, smallRatio, mediumRatio, largeRatio, xlargeRatio)
They are set to previous value if a value is not passed, or 1.0 if there is no previous value. The returned object is not modified.
Types ¶
type HPortion ¶
type HPortion struct {
Portions []float64
}
HPortion allows the canvas objects to be divided into portions of the width. The length of the Portions slice needs to be equal to the amount of canvas objects.
func NewHPortion ¶
NewHPortion creates a layout that partitions objects horizontally taking up as large of a portion of the space as defined by the given slice. The length of the Portions slice needs to be equal to the amount of objects.
type ResponsiveLayout ¶
type ResponsiveLayout struct{}
ResponsiveLayout is the layout that will adapt objects with the responsive rules. See NewResponsiveLayout for details.
func (*ResponsiveLayout) Layout ¶
func (resp *ResponsiveLayout) Layout(objects []fyne.CanvasObject, containerSize fyne.Size)
Layout will place the size and place the objects following the configured reponsive rules.
Implements: fyne.Layout
func (*ResponsiveLayout) MinSize ¶
func (resp *ResponsiveLayout) MinSize(objects []fyne.CanvasObject) fyne.Size
MinSize return the minimum size ot the layout.
Implements: fyne.Layout
type VPortion ¶
type VPortion struct {
Portions []float64
}
VPortion allows the canvas objects to be divided into portions of the height. The length of the Portions slice needs to be equal to the amount of canvas objects.
func NewVPortion ¶
NewVPortion creates a layout that partitions objects verticaly taking up as large of a portion of the space as defined by the given slice. The length of the Portions slice needs to be equal to the amount of objects.