diff --git a/widget/progressbar.go b/widget/progressbar.go index 200ba9d20d..390d5d237d 100644 --- a/widget/progressbar.go +++ b/widget/progressbar.go @@ -30,7 +30,8 @@ func (p *progressRenderer) MinSize() fyne.Size { tsize = fyne.MeasureText("100%", p.label.TextSize, p.label.TextStyle) } - return fyne.NewSize(tsize.Width+theme.InnerPadding()*2, tsize.Height+theme.InnerPadding()*2) + padding := theme.InnerPadding() * 2 + return fyne.NewSize(tsize.Width+padding, tsize.Height+padding) } func (p *progressRenderer) updateBar() { @@ -76,6 +77,7 @@ func (p *progressRenderer) Refresh() { p.updateBar() p.background.Refresh() p.bar.Refresh() + p.label.Refresh() canvas.Refresh(p.progress.super()) } @@ -127,7 +129,7 @@ func (p *ProgressBar) CreateRenderer() fyne.WidgetRenderer { background.CornerRadius = theme.InputRadiusSize() bar := canvas.NewRectangle(theme.PrimaryColor()) bar.CornerRadius = theme.InputRadiusSize() - label := canvas.NewText("0%", theme.ForegroundColor()) + label := canvas.NewText("0%", theme.BackgroundColor()) label.Alignment = fyne.TextAlignCenter return &progressRenderer{widget.NewBaseRenderer([]fyne.CanvasObject{background, bar, label}), background, bar, label, p} } diff --git a/widget/progressbar_test.go b/widget/progressbar_test.go index 385e2750f6..6a3375e9be 100644 --- a/widget/progressbar_test.go +++ b/widget/progressbar_test.go @@ -97,6 +97,11 @@ func TestProgressRenderer_ApplyTheme(t *testing.T) { bar := NewProgressBar() render := test.WidgetRenderer(bar).(*progressRenderer) + oldLabelColor := render.label.Color + render.Refresh() + newLabelColor := render.label.Color + assert.Equal(t, oldLabelColor, newLabelColor) + textSize := render.label.TextSize customTextSize := textSize test.WithTestTheme(t, func() {