From 55a274672498de50d4bcf80edf57672e650625fe Mon Sep 17 00:00:00 2001 From: Andy Williams Date: Wed, 11 Dec 2024 21:15:39 +0000 Subject: [PATCH] When a tab is asked to refresh just pass that to the button Fixes #5310 --- cmd/fyne_demo/tutorials/container.go | 7 ++++--- container/tabs.go | 3 +-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cmd/fyne_demo/tutorials/container.go b/cmd/fyne_demo/tutorials/container.go index 6ec57b415f..8291c57d83 100644 --- a/cmd/fyne_demo/tutorials/container.go +++ b/cmd/fyne_demo/tutorials/container.go @@ -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" ) @@ -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)))) diff --git a/container/tabs.go b/container/tabs.go index 742523e91c..0fe73c7ed3 100644 --- a/container/tabs.go +++ b/container/tabs.go @@ -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() }