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:
ZacharyZhang-NY committed 2026-10-05 13:48:13 -04:00
1 parent dbed3b603f
commit 5f217100ff
5 files changed
+17 -25

No files matched your search

+1 -11
View File
@@ -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()
}
}