From 679bf092cb8326afa16fe0a2063ce8ec062c661a Mon Sep 17 00:00:00 2001 From: Egon Elbre Date: Wed, 9 Dec 2020 14:03:13 +0200 Subject: [PATCH] layout: add Spacer Signed-off-by: Egon Elbre --- layout/layout.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/layout/layout.go b/layout/layout.go index 683dfef3..57e835af 100644 --- a/layout/layout.go +++ b/layout/layout.go @@ -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: