Skip to content

Commit

Permalink
SImplify the clickable icon a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacalz committed Jan 29, 2024
1 parent a2ffcdc commit cfd28fc
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions internal/ui/about.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"net/url"

"fyne.io/fyne/v2"
"fyne.io/fyne/v2/canvas"
"fyne.io/fyne/v2/container"
"fyne.io/fyne/v2/driver/desktop"
"fyne.io/fyne/v2/layout"
Expand Down Expand Up @@ -47,10 +46,9 @@ func newAboutTab(app fyne.App) *container.TabItem {
}

type clickableIcon struct {
widget.BaseWidget
app fyne.App
url *url.URL
icon *canvas.Image
widget.Icon
app fyne.App
url *url.URL
}

func (c *clickableIcon) Tapped(_ *fyne.PointEvent) {
Expand All @@ -64,15 +62,10 @@ func (c *clickableIcon) Cursor() desktop.Cursor {
return desktop.PointerCursor
}

func (c *clickableIcon) CreateRenderer() fyne.WidgetRenderer {
c.ExtendBaseWidget(c)
return widget.NewSimpleRenderer(c.icon)
}

func (c *clickableIcon) MinSize() fyne.Size {
return fyne.Size{Width: 256, Height: 256}
}

func newClickableIcon(res fyne.Resource, url *url.URL, app fyne.App) *clickableIcon {
return &clickableIcon{app: app, url: url, icon: canvas.NewImageFromResource(res)}
return &clickableIcon{Icon: widget.Icon{Resource: res}, app: app, url: url}
}

0 comments on commit cfd28fc

Please sign in to comment.