Refactor: delete StackItem
Callers skip a hidden child with if !hidden { build() }; an unbuilt
child already takes no room and no gap. Docs, Example and Gallery
updated.
This commit is contained in:
5 files changed
+17
-25
No files matched your search
@@ -26,7 +26,7 @@ type StackOptions struct {
|
||||
Wrap bool
|
||||
}
|
||||
|
||||
// Stack arranges children in a row or column. Build children with StackItem to hide them without leaving a gap.
|
||||
// Stack arranges children in a row or column. A child not built takes no room and no gap.
|
||||
func Stack(c *ui.Context, opts StackOptions, children func()) *ui.Element {
|
||||
if children == nil {
|
||||
panic("mujica: Stack needs children")
|
||||
@@ -57,13 +57,3 @@ func Stack(c *ui.Context, opts StackOptions, children func()) *ui.Element {
|
||||
}
|
||||
return e.Children(children)
|
||||
}
|
||||
|
||||
// StackItem builds one child of a Stack unless hidden; a hidden item takes no room and no gap.
|
||||
func StackItem(hidden bool, build func()) {
|
||||
if build == nil {
|
||||
panic("mujica: StackItem needs build")
|
||||
}
|
||||
if !hidden {
|
||||
build()
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user