Stack through StickyHeader, with behavior tests and gallery demos. kit gains Arrive, Settle (paint-time layout check) and Shade. Several actions return named ui.Element results; mygo vet forbids elements in structs. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
25 lines
554 B
Go
25 lines
554 B
Go
package layout
|
|
|
|
import (
|
|
"time"
|
|
|
|
"git.zacharyzhang.com/ZacharyZhang-NY/CrychicUI/kit"
|
|
"github.com/egoist/mygo/ui"
|
|
)
|
|
|
|
// Layers stacks layers on one box; each fades in turn.
|
|
func Layers(c *ui.Context, layers []func()) ui.Element {
|
|
if len(layers) == 0 {
|
|
panic("layout: Layers needs a layer")
|
|
}
|
|
return ui.Box(c).Children(func() {
|
|
for i, l := range layers {
|
|
b := ui.Box(c).Key(i)
|
|
if i > 0 {
|
|
b.Absolute().Top(0).Right(0).Bottom(0).Left(0)
|
|
}
|
|
kit.Arrive(b, ui.Pose{Fade: 1}, time.Duration(i)*80*time.Millisecond).Children(l)
|
|
}
|
|
})
|
|
}
|