Scroll artist bio (#945)

This commit is contained in:
Fábio Telles Justino
2026-06-19 08:12:32 -07:00
committed by GitHub
parent 9a8bc6c936
commit 0ae8a247d0
+15 -7
View File
@@ -587,7 +587,8 @@ type ArtistPageHeader struct {
artistImage *widgets.ImagePlaceholder artistImage *widgets.ImagePlaceholder
artistImageID string artistImageID string
titleDisp *widget.RichText titleDisp *widget.RichText
biographyDisp *widgets.MaxRowsLabel biographyDisp *widget.Label
biographyScroll *container.Scroll
similarArtists *fyne.Container similarArtists *fyne.Container
favoriteBtn *widgets.FavoriteButton favoriteBtn *widgets.FavoriteButton
playBtn *widget.Button playBtn *widget.Button
@@ -602,11 +603,17 @@ type ArtistPageHeader struct {
func NewArtistPageHeader(page *ArtistPage) *ArtistPageHeader { func NewArtistPageHeader(page *ArtistPage) *ArtistPageHeader {
// due to widget reuse a.artistPage can change so page MUST NOT // due to widget reuse a.artistPage can change so page MUST NOT
// be directly captured in a closure throughout this function! // be directly captured in a closure throughout this function!
biographyText := widget.NewLabel(lang.L(artistBioNotAvailableKey))
scroll := container.NewScroll(biographyText)
scroll.SetMinSize(fyne.NewSize(0, 100))
a := &ArtistPageHeader{ a := &ArtistPageHeader{
artistPage: page, artistPage: page,
titleDisp: widget.NewRichTextWithText(""), titleDisp: widget.NewRichTextWithText(""),
biographyDisp: widgets.NewMaxRowsLabel(5, lang.L(artistBioNotAvailableKey)), biographyDisp: biographyText,
similarArtists: container.NewHBox(), biographyScroll: scroll,
similarArtists: container.NewHBox(),
} }
a.titleDisp.Segments[0].(*widget.TextSegment).Style = widget.RichTextStyle{ a.titleDisp.Segments[0].(*widget.TextSegment).Style = widget.RichTextStyle{
SizeName: theme.SizeNameHeadingText, SizeName: theme.SizeNameHeadingText,
@@ -655,7 +662,6 @@ func NewArtistPageHeader(page *ArtistPage) *ArtistPageHeader {
// shareMenuItem.Disabled = !canShareArtists // shareMenuItem.Disabled = !canShareArtists
a.biographyDisp.Wrapping = fyne.TextWrapWord a.biographyDisp.Wrapping = fyne.TextWrapWord
a.biographyDisp.Truncation = fyne.TextTruncateEllipsis
a.collapseBtn = widgets.NewHeaderCollapseButton(func() { a.collapseBtn = widgets.NewHeaderCollapseButton(func() {
a.Compact = !a.Compact a.Compact = !a.Compact
a.artistPage.cfg.CompactHeader = a.Compact a.artistPage.cfg.CompactHeader = a.Compact
@@ -771,8 +777,10 @@ func (a *ArtistPageHeader) Refresh() {
a.similarArtists.Hidden = a.Compact a.similarArtists.Hidden = a.Compact
a.collapseBtn.Collapsed = a.Compact a.collapseBtn.Collapsed = a.Compact
if a.Compact { if a.Compact {
a.biographyScroll.Hide()
a.artistImage.SetMinSize(fyne.NewSquareSize(myTheme.CompactHeaderImageSize)) a.artistImage.SetMinSize(fyne.NewSquareSize(myTheme.CompactHeaderImageSize))
} else { } else {
a.biographyScroll.Show()
a.artistImage.SetMinSize(fyne.NewSquareSize(myTheme.HeaderImageSize)) a.artistImage.SetMinSize(fyne.NewSquareSize(myTheme.HeaderImageSize))
} }
a.BaseWidget.Refresh() a.BaseWidget.Refresh()
@@ -816,7 +824,7 @@ func (a *ArtistPageHeader) createContainer() {
container.NewBorder(nil, nil, a.artistImage, nil, container.NewBorder(nil, nil, a.artistImage, nil,
container.NewVBox( container.NewVBox(
container.New(layout.NewCustomPaddedVBoxLayout(theme.Padding()-10), container.New(layout.NewCustomPaddedVBoxLayout(theme.Padding()-10),
a.titleDisp, a.biographyDisp, a.similarArtists), a.titleDisp, a.biographyScroll, util.NewVSpace(10), a.similarArtists),
btnContainer), btnContainer),
), ),
container.NewVBox(container.NewHBox(layout.NewSpacer(), a.collapseBtn)), container.NewVBox(container.NewHBox(layout.NewSpacer(), a.collapseBtn)),