Skip to content

Commit

Permalink
Fix color of tab underline when theme changes
Browse files Browse the repository at this point in the history
  • Loading branch information
andydotxyz committed Mar 19, 2019
1 parent 1431743 commit 16f1fa7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion widget/tabcontainer.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ func (t *tabContainerRenderer) Layout(size fyne.Size) {
}

func (t *tabContainerRenderer) ApplyTheme() {
t.line.StrokeColor = theme.ButtonColor()
t.line.FillColor = theme.ButtonColor()
}

func (t *tabContainerRenderer) BackgroundColor() color.Color {
Expand Down
12 changes: 12 additions & 0 deletions widget/tabcontainer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package widget
import (
"testing"

"fyne.io/fyne"
"fyne.io/fyne/theme"
"github.com/stretchr/testify/assert"
)

Expand Down Expand Up @@ -44,3 +46,13 @@ func TestTabContainer_SelectTabIndex(t *testing.T) {
tabs.SelectTabIndex(1)
assert.Equal(t, 1, tabs.CurrentTabIndex())
}

func TestTabContainer_ApplyTheme(t *testing.T) {
tabs := NewTabContainer(&TabItem{Text: "Test1", Content: NewLabel("Test1")})
underline := Renderer(tabs).(*tabContainerRenderer).line
barColor := underline.FillColor

fyne.CurrentApp().Settings().SetTheme(theme.LightTheme())
Renderer(tabs).ApplyTheme()
assert.NotEqual(t, barColor, underline.FillColor)
}

0 comments on commit 16f1fa7

Please sign in to comment.