Skip to content

Commit

Permalink
Fix resize to apply to window on Show as well
Browse files Browse the repository at this point in the history
  • Loading branch information
andydotxyz committed Jan 27, 2021
1 parent b418db0 commit 3ceff0b
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions dialog/base.go
Expand Up @@ -31,9 +31,10 @@ type Dialog interface {
var _ Dialog = (*dialog)(nil)

type dialog struct {
callback func(bool)
title string
icon fyne.Resource
callback func(bool)
title string
icon fyne.Resource
desiredSize fyne.Size

win *widget.PopUp
bg *canvas.Rectangle
Expand Down Expand Up @@ -99,6 +100,9 @@ func (d *dialog) Hide() {
}

func (d *dialog) Show() {
if !d.desiredSize.IsZero() {
d.win.Resize(d.desiredSize)
}
d.win.Show()
}

Expand Down Expand Up @@ -141,6 +145,7 @@ func (d *dialog) Refresh() {

// Resize dialog, call this function after dialog show
func (d *dialog) Resize(size fyne.Size) {
d.desiredSize = size
maxSize := d.win.Size()
minSize := d.win.MinSize()
newWidth := size.Width
Expand Down

0 comments on commit 3ceff0b

Please sign in to comment.