Browse Source

Fill nil Flex space with default background color

Resolves #22.
tablepad
Trevor Slocum 2 years ago
parent
commit
f477be8ba4
  1. 1
      CHANGELOG
  2. 9
      flex.go

1
CHANGELOG

@ -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

9
flex.go

@ -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
}

Loading…
Cancel
Save