| 1 | // Copyright 2016 The Go Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style |
| 3 | // license that can be found in the LICENSE file. |
| 4 | |
| 5 | package widget |
| 6 | |
| 7 | import ( |
| 8 | "golang.org/x/exp/shiny/widget/node" |
| 9 | ) |
| 10 | |
| 11 | // Space is leaf widget that occupies empty space. For example, aligning two |
| 12 | // widgets to the left and right edges of a container can be achieved by |
| 13 | // placing a third Space widget between them, whose LayoutData makes that Space |
| 14 | // expand to occupy any excess space. Similarly, a widget can be centered in |
| 15 | // its container by adding an expanding Space before and after. |
| 16 | type Space struct { |
| 17 | node.LeafEmbed |
| 18 | } |
| 19 | |
| 20 | // NewSpace returns a new Space widget. |
| 21 | func NewSpace() *Space { |
| 22 | w := &Space{} |
| 23 | w.Wrapper = w |
| 24 | return w |
| 25 | } |