Implement defining screens in yaml
This commit is contained in:
@@ -2,14 +2,26 @@ package uilayout
|
||||
|
||||
import "fyne.io/fyne/v2"
|
||||
|
||||
// MinSize implements a min size layout.
|
||||
//
|
||||
// The MinSize layout will ensure that the container is rendered at a size that
|
||||
// is at least as large as the minimum size provided.
|
||||
type MinSize struct {
|
||||
minSize fyne.Size
|
||||
}
|
||||
|
||||
// NewMinSizeLayout creates a new MinSize layout with the specified minimum size.
|
||||
//
|
||||
// Arguments:
|
||||
// - minSize: the minimum size for the layout.
|
||||
//
|
||||
// Returns *MinSize: a pointer to the newly created MinSize layout.
|
||||
func NewMinSizeLayout(minSize fyne.Size) *MinSize {
|
||||
return &MinSize{minSize: minSize}
|
||||
}
|
||||
|
||||
// MinSize calculates the minimum size of the layout on the current screen. The
|
||||
// reported size will be at least as large as the configured minimum size.
|
||||
func (l *MinSize) MinSize(objects []fyne.CanvasObject) fyne.Size {
|
||||
size := l.minSize
|
||||
for _, o := range objects {
|
||||
@@ -24,6 +36,7 @@ func (l *MinSize) MinSize(objects []fyne.CanvasObject) fyne.Size {
|
||||
return size
|
||||
}
|
||||
|
||||
// Layout implements the Layout interface.
|
||||
func (l *MinSize) Layout(objects []fyne.CanvasObject, containerSize fyne.Size) {
|
||||
pos := fyne.NewPos(0, 0)
|
||||
for _, o := range objects {
|
||||
|
Reference in New Issue
Block a user