helpers

package module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 14, 2025 License: MIT Imports: 2 Imported by: 1

README

MGSmartFlow

MGSmartFlow é um layout flexível para Fyne que distribui widgets em linhas, calculando tamanhos e espaçamentos automaticamente.

Instalação

go get github.com/mugomes/mgsmartflow

Documentação

O MGSmartFlow foi desenvolvido para respeitar o tamanho da largura e altura da janela, portanto, caso o texto for muito longo, o mesmo será cortado e não exibirá a outra parte até que você aumente a janela ou use wrap para quebrar o texto.

Exemplo de Uso

flow := mgsmartflow.New()

/* Define o gap padrão para todas as linhas e colunas */
flow.SetGlobalGap(10, 8)

/* Label */
lbl1 := widget.NewLabel("Exemplo de Linha")
flow.AddRow(lbl1)
	
/* Botões em Colunas */
a := widget.NewButton("A", nil)
b := widget.NewButton("B", nil)
flow.AddColumn(a, b)

/* Redimensiona as colunas */
flow.SetResize(a, fyne.NewSize(120, 40))
flow.SetResize(b, fyne.NewSize(120, 40))

/* Ajusta o gap do button B */
flow.SetGap(b, fyne.NewPos(30, 0))

window.SetContent(flow.Container)

O SetResize e SetGap podem ser utilizados para ajustar linhas e colunas, o Gap afeta sempre o que vem na frente e não antes.

  • Caso o SetResize não seja definido, será aplicado o espaço total da largura da janela ou da coluna.
  • Caso o SetGap não seja definido, será aplicado automaticamente um espaço por padrão.

Information

Requirement

  • Go 1.24.6
  • Fyne 2.7.1

Support

License

Copyright (c) 2025 Murilo Gomes Julio

Licensed under the MIT license.

All contributions to the MGSmartFlow are subject to this license.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SmartFlow

type SmartFlow struct {
	Container *fyne.Container
	Layout    *SmartFlowLayout
}

func New

func New() *SmartFlow

func (*SmartFlow) AddColumn

func (s *SmartFlow) AddColumn(objs ...fyne.CanvasObject)

func (*SmartFlow) AddRow

func (s *SmartFlow) AddRow(obj fyne.CanvasObject)

func (*SmartFlow) SetGap

func (s *SmartFlow) SetGap(obj fyne.CanvasObject, gap fyne.Position)

func (*SmartFlow) SetGlobalGap

func (s *SmartFlow) SetGlobalGap(x, y float32)

func (*SmartFlow) SetMove

func (s *SmartFlow) SetMove(obj fyne.CanvasObject, pos fyne.Position)

func (*SmartFlow) SetResize

func (s *SmartFlow) SetResize(obj fyne.CanvasObject, size fyne.Size)

type SmartFlowLayout

type SmartFlowLayout struct {
	// contains filtered or unexported fields
}

func NewSmartFlowLayout

func NewSmartFlowLayout() *SmartFlowLayout

func (*SmartFlowLayout) AddColumn

func (l *SmartFlowLayout) AddColumn(objs ...fyne.CanvasObject)

func (*SmartFlowLayout) AddRow

func (l *SmartFlowLayout) AddRow(obj fyne.CanvasObject)

func (*SmartFlowLayout) Layout

func (l *SmartFlowLayout) Layout(objects []fyne.CanvasObject, size fyne.Size)

func (*SmartFlowLayout) MinSize

func (l *SmartFlowLayout) MinSize(objects []fyne.CanvasObject) fyne.Size

func (*SmartFlowLayout) SetGap

func (l *SmartFlowLayout) SetGap(obj fyne.CanvasObject, gap fyne.Position)

func (*SmartFlowLayout) SetGlobalGap

func (l *SmartFlowLayout) SetGlobalGap(x, y float32)

func (*SmartFlowLayout) SetMove

func (l *SmartFlowLayout) SetMove(obj fyne.CanvasObject, pos fyne.Position)

func (*SmartFlowLayout) SetResize

func (l *SmartFlowLayout) SetResize(obj fyne.CanvasObject, size fyne.Size)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL