| Conditions | 3 |
| Total Lines | 24 |
| Code Lines | 20 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | package ui |
||
| 32 | func ShowCustomDialog(title string, content fyne.CanvasObject, buttons ...*widget.Button) { |
||
| 33 | var modal *widget.PopUp |
||
| 34 | |||
| 35 | closeButton := widget.NewButton( |
||
| 36 | "Close", |
||
| 37 | func() { modal.Hide() }, |
||
| 38 | ) |
||
| 39 | buttonList := make([]fyne.CanvasObject, len(buttons)+1) |
||
| 40 | buttonList[0] = closeButton |
||
| 41 | idx := 1 |
||
| 42 | for _, button := range buttons { |
||
| 43 | buttonList[idx] = button |
||
| 44 | idx++ |
||
| 45 | } |
||
| 46 | buttonPanel := container.NewHBox(buttonList...) |
||
| 47 | container := container.NewBorder( |
||
| 48 | widget.NewLabel(title), |
||
| 49 | buttonPanel, |
||
| 50 | nil, |
||
| 51 | nil, |
||
| 52 | content, |
||
| 53 | ) |
||
| 54 | modal = widget.NewModalPopUp(container, Window.Canvas()) |
||
| 55 | modal.Show() |
||
| 56 | } |
||
| 57 |