Fill nil Flex space with default background color

Resolves #22.
This commit is contained in:
Trevor Slocum 2020-06-14 14:14:15 -07:00
parent 49536324ce
commit f477be8ba4
2 changed files with 8 additions and 2 deletions

View File

@ -1,6 +1,7 @@
v1.4.8 (WIP)
- Add italic text formatting flag
- Add Modal.GetForm and Modal.GetFrame
- Fill nil Flex space with default background color
v1.4.7 (2020-06-09)
- Add Box.SetBackgroundTransparent

View File

@ -90,12 +90,17 @@ func (f *Flex) SetFullScreen(fullScreen bool) *Flex {
// primitive receives focus. If multiple items have the "focus" flag set to
// true, the first one will receive focus.
//
// You can provide a nil value for the primitive. This will still consume screen
// space but nothing will be drawn.
// You can provide a nil value for the primitive. This will fill the empty
// screen space with the default background color. To show content behind the
// space, add a Box with a transparent background instead.
func (f *Flex) AddItem(item Primitive, fixedSize, proportion int, focus bool) *Flex {
f.Lock()
defer f.Unlock()
if item == nil {
item = NewBox()
}
f.items = append(f.items, &flexItem{Item: item, FixedSize: fixedSize, Proportion: proportion, Focus: focus})
return f
}