Documentation
¶
Overview ¶
Package splitview shows a list beside what's open from it when there's room, as on a tablet, and one at a time on a phone: picking from the list pushes the detail onto the screen's Stack. On a foldable that's half open with a vertical fold, the panes meet at the fold. It's plain Go, so it needs no plugin add; add hinge for the fold.
split := splitview.Use(c)
return splitview.View{
Split: split,
List: ordersList(split.Open), // its rows call split.Open(id)
Detail: func(id string) ui.Component { return OrderScreen{ID: id} },
Title: func(id string) string { return "Order " + id },
Empty: ui.Text("Pick an order", ui.Style{}),
Style: ui.Style{Grow: 1},
}
Put it inside a ui.Stack, which a phone needs for the detail to push onto.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Split ¶
type Split struct {
Selected string // the ID open in the detail pane; "" for none
// contains filtered or unexported fields
}
Split is what's open, and the way to open something.
type View ¶
type View struct {
Split Split // from Use
List ui.Component // its rows call Split.Open
Detail func(id string) ui.Component // what's open
Title func(id string) string // the pushed detail's title on a phone; nil for none
Empty ui.Component // the detail pane with nothing open; nil for blank
ListWidth float32 // the list's width side by side; 0 means 320
MinWidth float32 // the window width from which they go side by side; 0 means 700
Style ui.Style // its size and place; usually Grow: 1
}
View is the list and the detail.
Click to show internal directories.
Click to hide internal directories.