Conditions | 3 |
Total Lines | 26 |
Code Lines | 22 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | package ui |
||
33 | func NewCustomDialog(title string, content fyne.CanvasObject, buttons ...*widget.Button) fyne.Window { |
||
34 | var win fyne.Window |
||
35 | |||
36 | closeButton := widget.NewButton( |
||
37 | "Close", |
||
38 | func() { win.Hide() }, |
||
39 | ) |
||
40 | buttonList := make([]fyne.CanvasObject, len(buttons)+2) |
||
41 | buttonList[0] = layout.NewSpacer() |
||
42 | buttonList[1] = closeButton |
||
43 | idx := 2 |
||
44 | for _, button := range buttons { |
||
45 | buttonList[idx] = button |
||
46 | idx++ |
||
47 | } |
||
48 | buttonPanel := container.NewHBox(buttonList...) |
||
49 | container := container.NewBorder( |
||
50 | nil, |
||
51 | buttonPanel, |
||
52 | nil, |
||
53 | nil, |
||
54 | content, |
||
55 | ) |
||
56 | win = Application.NewWindow(title) |
||
57 | win.SetContent(container) |
||
58 | return win |
||
59 | } |
||
60 |