Skip to content

Commit

Permalink
add SizeName to Hyperlink
Browse files Browse the repository at this point in the history
  • Loading branch information
dweymouth committed May 8, 2024
1 parent aecc4f0 commit bc6ea78
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion widget/hyperlink.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,17 @@ type Hyperlink struct {
Alignment fyne.TextAlign // The alignment of the Text
Wrapping fyne.TextWrap // The wrapping of the Text
TextStyle fyne.TextStyle // The style of the hyperlink text

// The truncation mode of the hyperlink
//
// Since: 2.5
Truncation fyne.TextTruncation

// The theme size name for the text size of the hyperlink
//
// Since: 2.5
SizeName fyne.ThemeSizeName

// OnTapped overrides the default `fyne.OpenURL` call when the link is tapped
//
// Since: 2.2
Expand Down Expand Up @@ -283,7 +289,12 @@ func (hl *Hyperlink) syncSegments() {
segment.Style.TextStyle = hl.TextStyle
segment.Text = hl.Text

hl.textSize = fyne.MeasureText(hl.Text, th.Size(theme.SizeNameText), hl.TextStyle)
sizeName := hl.SizeName
if sizeName == "" {
sizeName = theme.SizeNameText
}
segment.Style.SizeName = sizeName
hl.textSize = fyne.MeasureText(hl.Text, th.Size(sizeName), hl.TextStyle)
}

var _ fyne.WidgetRenderer = (*hyperlinkRenderer)(nil)
Expand Down

0 comments on commit bc6ea78

Please sign in to comment.