use rounded image corners (TODO: allow disabling this)
This commit is contained in:
@@ -11,6 +11,7 @@ import (
|
||||
|
||||
"fyne.io/fyne/v2"
|
||||
"fyne.io/fyne/v2/container"
|
||||
"fyne.io/fyne/v2/theme"
|
||||
"fyne.io/fyne/v2/widget"
|
||||
)
|
||||
|
||||
@@ -47,6 +48,7 @@ func NewBottomPanel(pm *backend.PlaybackManager, im *backend.ImageManager, contr
|
||||
pm.OnStopped(util.FyneDoFunc(func() { bp.Controls.SetPlaying(false) }))
|
||||
|
||||
bp.NowPlaying = widgets.NewNowPlayingCard()
|
||||
bp.NowPlaying.ImageCornerRadius = theme.InputRadiusSize()
|
||||
bp.NowPlaying.OnCoverTapped = func() {
|
||||
contr.NavigateTo(controller.NowPlayingRoute())
|
||||
}
|
||||
|
||||
@@ -231,6 +231,7 @@ func NewAlbumPageHeader(page *AlbumPage) *AlbumPageHeader {
|
||||
a.ExtendBaseWidget(a)
|
||||
a.cover = widgets.NewImagePlaceholder(myTheme.AlbumIcon, 225)
|
||||
a.cover.OnTapped = func(*fyne.PointEvent) { go a.showPopUpCover() }
|
||||
a.cover.CornerRadius = theme.InputRadiusSize()
|
||||
|
||||
a.titleLabel = widget.NewRichTextWithText("")
|
||||
a.titleLabel.Truncation = fyne.TextTruncateEllipsis
|
||||
|
||||
@@ -503,6 +503,7 @@ func NewArtistPageHeader(page *ArtistPage) *ArtistPageHeader {
|
||||
}
|
||||
a.artistImage = widgets.NewImagePlaceholder(myTheme.ArtistIcon, 225)
|
||||
a.artistImage.OnTapped = func(*fyne.PointEvent) { a.showPopUpCover() }
|
||||
a.artistImage.CornerRadius = theme.InputRadiusSize()
|
||||
a.favoriteBtn = widgets.NewFavoriteButton(func() { go a.toggleFavorited() })
|
||||
a.playBtn = widget.NewButtonWithIcon(lang.L("Play Discography"), theme.MediaPlayIcon(), func() {
|
||||
go a.artistPage.pm.PlayArtistDiscography(a.artistID, false /*shuffle*/)
|
||||
|
||||
@@ -110,6 +110,7 @@ func NewNowPlayingPage(
|
||||
pm.OnStopped(doFmtStatus)
|
||||
|
||||
a.card = widgets.NewLargeNowPlayingCard()
|
||||
a.card.ImageCornerRadius = theme.InputRadiusSize()
|
||||
a.card.OnAlbumNameTapped = func() {
|
||||
contr.NavigateTo(controller.AlbumRoute(a.nowPlaying.Metadata().AlbumID))
|
||||
}
|
||||
|
||||
@@ -328,6 +328,7 @@ func NewPlaylistPageHeader(page *PlaylistPage) *PlaylistPageHeader {
|
||||
|
||||
a.image = widgets.NewImagePlaceholder(myTheme.PlaylistIcon, 225)
|
||||
a.image.OnTapped = func(*fyne.PointEvent) { go a.showPopUpCover() }
|
||||
a.image.CornerRadius = theme.InputRadiusSize()
|
||||
a.titleLabel = util.NewTruncatingRichText()
|
||||
a.titleLabel.Segments[0].(*widget.TextSegment).Style = widget.RichTextStyle{
|
||||
SizeName: theme.SizeNameHeadingText,
|
||||
|
||||
@@ -15,11 +15,11 @@ type ThemedRectangle struct {
|
||||
|
||||
rect *canvas.Rectangle
|
||||
|
||||
ColorName fyne.ThemeColorName
|
||||
Translucent bool
|
||||
BorderWidth float32
|
||||
BorderColorName fyne.ThemeColorName
|
||||
CornerRadiusName fyne.ThemeSizeName
|
||||
ColorName fyne.ThemeColorName
|
||||
Translucent bool
|
||||
BorderWidth float32
|
||||
BorderColorName fyne.ThemeColorName
|
||||
CornerRadius float32
|
||||
}
|
||||
|
||||
func NewThemedRectangle(colorName fyne.ThemeColorName) *ThemedRectangle {
|
||||
@@ -43,9 +43,7 @@ func (t *ThemedRectangle) Refresh() {
|
||||
t.rect.FillColor = fc
|
||||
t.rect.StrokeWidth = t.BorderWidth
|
||||
t.rect.StrokeColor = theme.Color(t.BorderColorName, settings.ThemeVariant())
|
||||
if t.CornerRadiusName != "" {
|
||||
t.rect.CornerRadius = theme.Size(t.CornerRadiusName)
|
||||
}
|
||||
t.rect.CornerRadius = t.CornerRadius
|
||||
t.BaseWidget.Refresh()
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -365,7 +365,7 @@ func AddHeaderBackground(obj fyne.CanvasObject) *fyne.Container {
|
||||
|
||||
func AddHeaderBackgroundWithColorName(obj fyne.CanvasObject, colorName fyne.ThemeColorName) *fyne.Container {
|
||||
bgrnd := myTheme.NewThemedRectangle(colorName)
|
||||
bgrnd.CornerRadiusName = theme.SizeNameInputRadius
|
||||
bgrnd.CornerRadius = theme.InputRadiusSize()
|
||||
return container.NewStack(bgrnd,
|
||||
container.New(&layout.CustomPaddedLayout{LeftPadding: 10, RightPadding: 10, TopPadding: 10, BottomPadding: 10},
|
||||
obj))
|
||||
|
||||
@@ -304,6 +304,7 @@ func (g *GridView) createGridWrap() {
|
||||
|
||||
func (g *GridView) createNewItemCard() fyne.CanvasObject {
|
||||
card := NewGridViewItem(g.Placeholder)
|
||||
card.Cover.Im.CornerRadius = theme.InputRadiusSize()
|
||||
card.SetSize(backend.AppInstance().Config.GridView.CardSize)
|
||||
card.ItemIndex = -1
|
||||
card.ImgLoader = util.NewThumbnailLoader(g.imageFetcher, card.Cover.SetImage)
|
||||
|
||||
@@ -17,6 +17,7 @@ import (
|
||||
type ImagePlaceholder struct {
|
||||
ScaleMode canvas.ImageScale
|
||||
PlaceholderIcon fyne.Resource
|
||||
CornerRadius float32
|
||||
|
||||
widget.BaseWidget
|
||||
content *fyne.Container
|
||||
@@ -109,6 +110,8 @@ func (i *ImagePlaceholder) Refresh() {
|
||||
i.imageDisp.Hidden = !i.HaveImage()
|
||||
i.imageDisp.ScaleMode = i.ScaleMode
|
||||
i.iconImage.ScaleMode = i.ScaleMode
|
||||
i.imageDisp.CornerRadius = i.CornerRadius
|
||||
i.border.CornerRadius = i.CornerRadius
|
||||
i.BaseWidget.Refresh()
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,8 @@ import (
|
||||
type LargeNowPlayingCard struct {
|
||||
CaptionedImage
|
||||
|
||||
DisableRating bool
|
||||
DisableRating bool
|
||||
ImageCornerRadius float32
|
||||
|
||||
isRadio bool
|
||||
trackName *widget.RichText
|
||||
@@ -163,5 +164,6 @@ func (n *LargeNowPlayingCard) Refresh() {
|
||||
} else {
|
||||
n.rating.Enable()
|
||||
}
|
||||
n.cover.CornerRadius = n.ImageCornerRadius
|
||||
n.BaseWidget.Refresh()
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ func NewListHeader(cols []ListColumn, layout *layouts.ColumnsLayout) *ListHeader
|
||||
l.columnVisible[i] = true
|
||||
}
|
||||
rect := myTheme.NewThemedRectangle(myTheme.ColorNameListHeader)
|
||||
rect.CornerRadiusName = theme.SizeNameSelectionRadius
|
||||
rect.CornerRadius = theme.SelectionRadiusSize()
|
||||
l.container = container.NewStack(rect, l.columnsContainer)
|
||||
l.ExtendBaseWidget(l)
|
||||
l.buildColumns()
|
||||
|
||||
@@ -23,7 +23,8 @@ import (
|
||||
type NowPlayingCard struct {
|
||||
widget.BaseWidget
|
||||
|
||||
DisableRating bool
|
||||
DisableRating bool
|
||||
ImageCornerRadius float32
|
||||
|
||||
trackName *OptionHyperlink
|
||||
artistName *MultiHyperlink
|
||||
@@ -163,6 +164,11 @@ func (n *NowPlayingCard) Update(track mediaprovider.MediaItem) {
|
||||
n.Refresh()
|
||||
}
|
||||
|
||||
func (n *NowPlayingCard) Refresh() {
|
||||
n.cover.CornerRadius = n.ImageCornerRadius
|
||||
n.BaseWidget.Refresh()
|
||||
}
|
||||
|
||||
func (n *NowPlayingCard) SetImage(cover image.Image) {
|
||||
n.cover.SetImage(cover, true)
|
||||
}
|
||||
|
||||
@@ -389,6 +389,7 @@ func NewPlayQueueListRow(playQueueList *PlayQueueList, im *backend.ImageManager,
|
||||
p.ExtendBaseWidget(p)
|
||||
|
||||
p.cover.ScaleMode = canvas.ImageScaleFastest
|
||||
p.cover.CornerRadius = theme.InputRadiusSize()
|
||||
p.title.OnMouseIn = p.MouseIn
|
||||
p.title.OnMouseOut = p.MouseOut
|
||||
p.artist.OnTapped = playQueueList.onArtistTapped
|
||||
|
||||
@@ -274,6 +274,7 @@ func NewExpandedTracklistRow(tracklist *Tracklist, im *backend.ImageManager, pla
|
||||
t.playingIcon = playingIcon
|
||||
t.img = NewImagePlaceholder(myTheme.TracksIcon, tracklistThumbnailSize)
|
||||
t.img.ScaleMode = canvas.ImageScaleFastest
|
||||
t.img.CornerRadius = theme.InputRadiusSize()
|
||||
|
||||
t.imageLoader = util.NewThumbnailLoader(im, func(i image.Image) {
|
||||
t.img.SetImage(i, false)
|
||||
|
||||
Reference in New Issue
Block a user