move HSpace to util package

This commit is contained in:
Drew Weymouth
2023-03-14 10:21:22 -07:00
parent 8c6b2fa789
commit 26c6ee7ac8
8 changed files with 33 additions and 35 deletions
+22
View File
@@ -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())
}