layout: add Spacer

Signed-off-by: Egon Elbre <egonelbre@gmail.com>
This commit is contained in:
Egon Elbre
2020-12-09 14:03:13 +02:00
committed by Elias Naur
parent e71bf13c9a
commit 679bf092cb
+14
View File
@@ -194,6 +194,20 @@ func (d Direction) Layout(gtx Context, w Widget) Dimensions {
}
}
// Spacer adds space between widgets.
type Spacer struct {
Width, Height unit.Value
}
func (s Spacer) Layout(gtx Context) Dimensions {
return Dimensions{
Size: image.Point{
X: gtx.Px(s.Width),
Y: gtx.Px(s.Height),
},
}
}
func (a Alignment) String() string {
switch a {
case Start: