package npc import ( "fmt" "fyne.io/fyne/v2" ) type FieldEditor struct { Representation *fyne.Container Creators []*FieldCreator } var fieldEditor *FieldEditor func GetFieldEditor() *FieldEditor { if fieldEditor == nil { container := NewFlowLayout() fieldEditor = &FieldEditor{container, []*FieldCreator{}} container.Add(GetAdder()) } return fieldEditor } func (ed *FieldEditor) AddFieldCreator(fieldCreator *FieldCreator) { ed.Creators = append(fieldEditor.Creators, fieldCreator) ed.Redraw() } func (ed *FieldEditor) Redraw() { ed.Representation.RemoveAll() for _, v := range ed.Creators { ed.Representation.Add(v.Representation) fmt.Printf("Minsize: %f, %f", v.Representation.MinSize().Height, v.Representation.MinSize().Width) } ed.Representation.Add(GetAdder()) }