package sync import ( "image/color" "fyne.io/fyne/v2" "fyne.io/fyne/v2/canvas" "fyne.io/fyne/v2/container" "fyne.io/fyne/v2/dialog" "fyne.io/fyne/v2/layout" "fyne.io/fyne/v2/widget" ) type ( SyncDialog struct { *dialog.CustomDialog label *canvas.Text pg *widget.ProgressBar } ) func Make(total int, w fyne.Window) *SyncDialog { title := canvas.NewText("Warming up...", color.Black) title.Alignment = fyne.TextAlignCenter pg := widget.NewProgressBar() pg.Max = float64(total) c := container.New(layout.NewVBoxLayout(), title, pg) d := &SyncDialog{ CustomDialog: dialog.NewCustomWithoutButtons("Syncing", c, w), label: title, pg: pg, } return d } func (s *SyncDialog) UpdateLabel(msg string) { s.label.Text = msg s.Refresh() } func (s *SyncDialog) UpdateProgressBar(percentage int) { s.pg.Value = float64(percentage) s.Refresh() }