VirtualList
長いリストや高さが可変のコレクションの表示範囲をレイアウトして描画します。
デモを読み込み中…
func VirtualListExample(rows []string, rowHeights []float64) *ui.Element {
return ui.VirtualList().Child(func() *native.Node {
var children []*native.Node
for _, row := range rows {
children = append(children, ui.Text(row).Height(36).Node)
}
return ui.Fragment(children)
}).Height(320).EstimatedItemHeight(36).Overscan(6).
OverscanPixels(240).ItemHeights(rowHeights).FollowMode("normal")
}#インポート
github.com/egoist/quickgui/go/ui から ui をインポートします。
import (
"github.com/egoist/quickgui/go/ui"
)#使い方
func VirtualListExample(rows []string, rowHeights []float64) *ui.Element {
return ui.VirtualList().Child(func() *native.Node {
var children []*native.Node
for _, row := range rows {
children = append(children, ui.Text(row).Height(36).Node)
}
return ui.Fragment(children)
}).Height(320).EstimatedItemHeight(36).Overscan(6).
OverscanPixels(240).ItemHeights(rowHeights).FollowMode("normal")
}#API リファレンス
項目を展開すると説明と完全なシグネチャが表示されます。ダッシュは宣言に既定値が記載されていないことを示します。
VirtualList
ソースを見るui.VirtualList() *ElementVirtualList lays out and paints the visible children using the core's virtual list.
ChildChild(child any) *Element—
Child appends content and returns this element. Content can be an element, native node, scalar, accessor, or node-returning construction callback.
Child(child any) *Elementソースを見るChildrenChildren(children ...any) *Element—
Children appends multiple children in order without replacing existing content. It also accepts []any, []*Element, and []*native.Node slices as arguments. Read the retained child nodes through element.Node.Children.
Children(children ...any) *Elementソースを見るStyleStyle(style StyleBuilder) *Element—
Style merges a reusable style. Scalar accessors retain independent native bindings.
Style(style StyleBuilder) *Elementソースを見るOnClickOnClick(handler func()) *Element—
RefRef(handler func(*native.Node)) *Element—
Ref exposes the native handle once at this point in the declaration chain.
Ref(handler func(*native.Node)) *Elementソースを見るOnKeyDownOnKeyDown(value func(*native.Event)) *Element—
OnKeyDown configures the corresponding node property.
OnKeyDown(value func(*native.Event)) *Elementソースを見るOnFocusOnFocus(value func(*native.Event)) *Element—
OnFocus configures the corresponding node property.
OnFocus(value func(*native.Event)) *Elementソースを見るOnBlurOnBlur(value func(*native.Event)) *Element—
DisabledDisabled(value any) *Element—
AriaLabelAriaLabel(value any) *Element—
EstimatedItemHeightEstimatedItemHeight(value any) *Element—
EstimatedItemHeight configures the corresponding node property.
EstimatedItemHeight(value any) *Elementソースを見る