Skip to content

Commit

Permalink
When a tab is asked to refresh just pass that to the button
Browse files Browse the repository at this point in the history
  • Loading branch information
andydotxyz committed Dec 11, 2024
1 parent c89253d commit 7b93933
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
7 changes: 4 additions & 3 deletions cmd/fyne_demo/tutorials/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"fyne.io/fyne/v2/canvas"
"fyne.io/fyne/v2/cmd/fyne_demo/data"
"fyne.io/fyne/v2/container"
"fyne.io/fyne/v2/theme"
"fyne.io/fyne/v2/widget"
)

Expand All @@ -25,9 +26,9 @@ func containerScreen(_ fyne.Window) fyne.CanvasObject {

func makeAppTabsTab(_ fyne.Window) fyne.CanvasObject {
tabs := container.NewAppTabs(
container.NewTabItem("Tab 1", widget.NewLabel("Content of tab 1")),
container.NewTabItem("Tab 2 bigger", widget.NewLabel("Content of tab 2")),
container.NewTabItem("Tab 3", widget.NewLabel("Content of tab 3")),
container.NewTabItemWithIcon("Tab 1", theme.HomeIcon(), widget.NewLabel("Content of tab 1")),
container.NewTabItemWithIcon("Tab 2 bigger", theme.ComputerIcon(), widget.NewLabel("Content of tab 2")),
container.NewTabItemWithIcon("Tab 3", theme.MediaVideoIcon(), widget.NewLabel("Content of tab 3")),
)
for i := 4; i <= 12; i++ {
tabs.Append(container.NewTabItem(fmt.Sprintf("Tab %d", i), widget.NewLabel(fmt.Sprintf("Content of tab %d", i))))
Expand Down
3 changes: 1 addition & 2 deletions container/tabs.go
Original file line number Diff line number Diff line change
Expand Up @@ -708,14 +708,13 @@ func (r *tabButtonRenderer) Refresh() {
case *theme.ThemedResource:
if r.button.importance == widget.HighImportance {
r.icon.Resource = theme.NewPrimaryThemedResource(res)
r.icon.Refresh()
}
case *theme.PrimaryThemedResource:
if r.button.importance != widget.HighImportance {
r.icon.Resource = res.Original()
r.icon.Refresh()
}
}
r.icon.Refresh()
} else {
r.icon.Hide()
}
Expand Down

0 comments on commit 7b93933

Please sign in to comment.