Skip to content

Commit

Permalink
Merge pull request #1613 from andydotxyz/fix/1370
Browse files Browse the repository at this point in the history
Fix issue where dialog shadows may not resize
  • Loading branch information
andydotxyz committed Nov 27, 2020
2 parents e5f30d6 + 4acd703 commit aa105c6
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -14,6 +14,7 @@ More detailed release notes can be found on the [releases page](https://github.c
* [fyne-cli] Android: allow to specify an inline password for the keystore
* Fixed Card widget MinSize (#1581)
* Fix missing release tag to enable BuildRelease in Settings.BuildType()
* Dialog shadow does not resize after Refresh (#1370)


## 1.4.1 - 20 November 2020
Expand Down
4 changes: 2 additions & 2 deletions dialog/color.go
Expand Up @@ -21,7 +21,7 @@ type ColorPickerDialog struct {
Advanced bool
color color.Color
callback func(c color.Color)
advanced *widget.AccordionContainer
advanced *widget.Accordion
picker *colorAdvancedPicker
}

Expand Down Expand Up @@ -94,7 +94,7 @@ func (p *ColorPickerDialog) updateUI() {
p.picker = newColorAdvancedPicker(p.color, func(c color.Color) {
p.color = c
})
p.advanced = widget.NewAccordionContainer(widget.NewAccordionItem("Advanced", p.picker))
p.advanced = widget.NewAccordion(widget.NewAccordionItem("Advanced", p.picker))

p.dialog.content = fyne.NewContainerWithLayout(layout.NewVBoxLayout(),
fyne.NewContainerWithLayout(layout.NewCenterLayout(),
Expand Down
Binary file modified dialog/testdata/color/dialog_expanded_theme_dark.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified dialog/testdata/color/dialog_expanded_theme_light.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 4 additions & 2 deletions widget/popup.go
Expand Up @@ -232,7 +232,9 @@ type modalPopUpRenderer struct {

func (r *modalPopUpRenderer) Layout(canvasSize fyne.Size) {
padding := r.padding()
requestedSize := r.popUp.innerSize.Subtract(padding)
innerSize := r.popUp.innerSize.Max(r.popUp.Content.MinSize().Add(padding))

requestedSize := innerSize.Subtract(padding)
size := r.popUp.Content.MinSize().Max(requestedSize)
size = size.Min(canvasSize.Subtract(padding))
pos := fyne.NewPos((canvasSize.Width-size.Width)/2, (canvasSize.Height-size.Height)/2)
Expand All @@ -242,7 +244,7 @@ func (r *modalPopUpRenderer) Layout(canvasSize fyne.Size) {
innerPos := pos.Subtract(r.offset())
r.bg.Move(innerPos)
r.bg.Resize(size.Add(padding))
r.LayoutShadow(r.popUp.innerSize, innerPos)
r.LayoutShadow(innerSize, innerPos)
}

func (r *modalPopUpRenderer) MinSize() fyne.Size {
Expand Down

0 comments on commit aa105c6

Please sign in to comment.