move HSpace to util package
This commit is contained in:
@@ -186,8 +186,8 @@ func NewAlbumPageHeader(page *AlbumPage) *AlbumPageHeader {
|
||||
container.NewVBox(
|
||||
container.New(&layouts.VboxCustomPadding{ExtraPad: -12}, a.artistLabel, a.genreLabel, a.miscLabel),
|
||||
container.NewVBox(
|
||||
container.NewHBox(widgets.NewHSpace(2), playButton, shuffleBtn),
|
||||
container.NewHBox(widgets.NewHSpace(2), a.toggleFavButton),
|
||||
container.NewHBox(util.NewHSpace(2), playButton, shuffleBtn),
|
||||
container.NewHBox(util.NewHSpace(2), a.toggleFavButton),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"supersonic/backend"
|
||||
"supersonic/sharedutil"
|
||||
"supersonic/ui/controller"
|
||||
"supersonic/ui/util"
|
||||
"supersonic/ui/widgets"
|
||||
|
||||
"fyne.io/fyne/v2"
|
||||
@@ -92,7 +93,7 @@ func (a *AlbumsPage) createContainer(searchgrid bool) {
|
||||
g = a.searchGrid
|
||||
}
|
||||
a.container = container.NewBorder(
|
||||
container.NewHBox(widgets.NewHSpace(6), a.titleDisp, sortVbox, layout.NewSpacer(), searchVbox, widgets.NewHSpace(12)),
|
||||
container.NewHBox(util.NewHSpace(6), a.titleDisp, sortVbox, layout.NewSpacer(), searchVbox, util.NewHSpace(12)),
|
||||
nil,
|
||||
nil,
|
||||
nil,
|
||||
|
||||
@@ -73,7 +73,7 @@ func newArtistPage(artistID string, cfg *backend.ArtistPageConfig, pm *backend.P
|
||||
viewToggle.OnChanged = a.onViewChange
|
||||
//line := canvas.NewLine(theme.TextColor())
|
||||
viewToggleRow := container.NewBorder(nil, nil,
|
||||
container.NewHBox(&widgets.HSpace{Width: 5}, viewToggle), nil,
|
||||
container.NewHBox(util.NewHSpace(5), viewToggle), nil,
|
||||
layout.NewSpacer(),
|
||||
)
|
||||
a.container = container.NewBorder(
|
||||
@@ -329,7 +329,7 @@ func (a *ArtistPageHeader) createContainer() {
|
||||
container.NewVBox(
|
||||
container.New(&layouts.VboxCustomPadding{ExtraPad: -10},
|
||||
a.titleDisp, a.biographyDisp, a.similarArtists),
|
||||
container.NewHBox(widgets.NewHSpace(2), a.favoriteBtn, a.playBtn, a.playRadioBtn)))
|
||||
container.NewHBox(util.NewHSpace(2), a.favoriteBtn, a.playBtn, a.playRadioBtn)))
|
||||
}
|
||||
|
||||
func (a *ArtistPageHeader) CreateRenderer() fyne.WidgetRenderer {
|
||||
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
"supersonic/res"
|
||||
"supersonic/ui/controller"
|
||||
"supersonic/ui/layouts"
|
||||
"supersonic/ui/util"
|
||||
"supersonic/ui/widgets"
|
||||
"time"
|
||||
|
||||
@@ -89,7 +90,7 @@ func (a *FavoritesPage) connectGridActions() {
|
||||
func (a *FavoritesPage) createContainer(initialView fyne.CanvasObject) {
|
||||
searchVbox := container.NewVBox(layout.NewSpacer(), a.searcher.Entry, layout.NewSpacer())
|
||||
a.container = container.NewBorder(
|
||||
container.NewHBox(widgets.NewHSpace(9), a.titleDisp, container.NewCenter(a.toggleBtns), layout.NewSpacer(), searchVbox, widgets.NewHSpace(15)),
|
||||
container.NewHBox(util.NewHSpace(9), a.titleDisp, container.NewCenter(a.toggleBtns), layout.NewSpacer(), searchVbox, util.NewHSpace(15)),
|
||||
nil, nil, nil, initialView)
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"supersonic/backend"
|
||||
"supersonic/res"
|
||||
"supersonic/ui/controller"
|
||||
"supersonic/ui/util"
|
||||
"supersonic/ui/widgets"
|
||||
|
||||
"fyne.io/fyne/v2"
|
||||
@@ -70,7 +71,7 @@ func (g *GenrePage) createContainer(searchGrid bool) {
|
||||
}
|
||||
playRandomVbox := container.NewVBox(layout.NewSpacer(), g.playRandom, layout.NewSpacer())
|
||||
g.container = container.NewBorder(
|
||||
container.NewHBox(widgets.NewHSpace(6), g.titleDisp, playRandomVbox, layout.NewSpacer(), searchVbox, widgets.NewHSpace(15)),
|
||||
container.NewHBox(util.NewHSpace(6), g.titleDisp, playRandomVbox, layout.NewSpacer(), searchVbox, util.NewHSpace(15)),
|
||||
nil,
|
||||
nil,
|
||||
nil,
|
||||
|
||||
@@ -6,6 +6,8 @@ import (
|
||||
"math"
|
||||
"strings"
|
||||
|
||||
"fyne.io/fyne/v2"
|
||||
"fyne.io/fyne/v2/layout"
|
||||
"fyne.io/fyne/v2/widget"
|
||||
"golang.org/x/net/html"
|
||||
)
|
||||
@@ -53,3 +55,23 @@ func RichTextSegsFromHTMLString(s string) []widget.RichTextSegment {
|
||||
|
||||
return segs
|
||||
}
|
||||
|
||||
type HSpace struct {
|
||||
widget.BaseWidget
|
||||
|
||||
Width float32
|
||||
}
|
||||
|
||||
func NewHSpace(w float32) *HSpace {
|
||||
h := &HSpace{Width: w}
|
||||
h.ExtendBaseWidget(h)
|
||||
return h
|
||||
}
|
||||
|
||||
func (h *HSpace) MinSize() fyne.Size {
|
||||
return fyne.NewSize(h.Width, 0)
|
||||
}
|
||||
|
||||
func (h *HSpace) CreateRenderer() fyne.WidgetRenderer {
|
||||
return widget.NewSimpleRenderer(layout.NewSpacer())
|
||||
}
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
package widgets
|
||||
|
||||
import (
|
||||
"fyne.io/fyne/v2"
|
||||
"fyne.io/fyne/v2/layout"
|
||||
"fyne.io/fyne/v2/widget"
|
||||
)
|
||||
|
||||
type HSpace struct {
|
||||
widget.BaseWidget
|
||||
|
||||
Width float32
|
||||
}
|
||||
|
||||
func NewHSpace(w float32) *HSpace {
|
||||
h := &HSpace{Width: w}
|
||||
h.ExtendBaseWidget(h)
|
||||
return h
|
||||
}
|
||||
|
||||
func (h *HSpace) MinSize() fyne.Size {
|
||||
return fyne.NewSize(h.Width, 0)
|
||||
}
|
||||
|
||||
func (h *HSpace) CreateRenderer() fyne.WidgetRenderer {
|
||||
return widget.NewSimpleRenderer(layout.NewSpacer())
|
||||
}
|
||||
@@ -75,7 +75,7 @@ func NewTracklist(tracks []*subsonic.Child) *Tracklist {
|
||||
t.OnColumnVisibilityMenuShown(pop)
|
||||
}
|
||||
}
|
||||
playingIcon := container.NewCenter(container.NewHBox(NewHSpace(2), widget.NewIcon(theme.MediaPlayIcon())))
|
||||
playingIcon := container.NewCenter(container.NewHBox(util.NewHSpace(2), widget.NewIcon(theme.MediaPlayIcon())))
|
||||
t.list = widget.NewList(
|
||||
func() int { return len(t.Tracks) },
|
||||
func() fyne.CanvasObject {
|
||||
|
||||
Reference in New Issue
Block a user