Documentation
¶
Overview ¶
Package list provides virtualized list rendering for large datasets.
Index ¶
- type ListItem
- type ScrollableList
- type VirtualList
- func (l *VirtualList) ItemCount() int
- func (l *VirtualList) ScrollBy(delta int)
- func (l *VirtualList) ScrollTo(index int)
- func (l *VirtualList) ScrollToBottom()
- func (l *VirtualList) Select(index int)
- func (l *VirtualList) SelectedIndex() int
- func (l *VirtualList) SetEstimatedHeight(h int)
- func (l *VirtualList) SetItemHeight(id string, height int)
- func (l *VirtualList) SetItems(items []ListItem)
- func (l *VirtualList) SetViewport(height, width int)
- func (l *VirtualList) TotalHeight() int
- func (l *VirtualList) VisibleItems() []VisibleItem
- type VisibleItem
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ScrollableList ¶
type ScrollableList struct {
*VirtualList
// contains filtered or unexported fields
}
ScrollableList provides smooth scrolling with animation.
func NewScrollableList ¶
func NewScrollableList() *ScrollableList
NewScrollableList creates a new scrollable list.
func (*ScrollableList) ScrollDown ¶
func (l *ScrollableList) ScrollDown()
ScrollDown scrolls down by one item.
func (*ScrollableList) ScrollToIndex ¶
func (l *ScrollableList) ScrollToIndex(index int, animate bool)
ScrollToIndex scrolls to the given index with optional animation.
func (*ScrollableList) ScrollUp ¶
func (l *ScrollableList) ScrollUp()
ScrollUp scrolls up by one item.
type VirtualList ¶
type VirtualList struct {
// contains filtered or unexported fields
}
VirtualList provides efficient rendering of large lists by only rendering visible items.
func (*VirtualList) ItemCount ¶
func (l *VirtualList) ItemCount() int
ItemCount returns the number of items.
func (*VirtualList) ScrollBy ¶
func (l *VirtualList) ScrollBy(delta int)
ScrollBy scrolls by the given number of items.
func (*VirtualList) ScrollTo ¶
func (l *VirtualList) ScrollTo(index int)
ScrollTo scrolls to make the given item visible.
func (*VirtualList) ScrollToBottom ¶
func (l *VirtualList) ScrollToBottom()
ScrollToBottom scrolls to the bottom of the list.
func (*VirtualList) Select ¶
func (l *VirtualList) Select(index int)
Select selects the item at the given index.
func (*VirtualList) SelectedIndex ¶
func (l *VirtualList) SelectedIndex() int
SelectedIndex returns the currently selected item index.
func (*VirtualList) SetEstimatedHeight ¶
func (l *VirtualList) SetEstimatedHeight(h int)
SetEstimatedHeight sets the estimated item height for items not yet measured.
func (*VirtualList) SetItemHeight ¶
func (l *VirtualList) SetItemHeight(id string, height int)
SetItemHeight updates the measured height for an item.
func (*VirtualList) SetItems ¶
func (l *VirtualList) SetItems(items []ListItem)
SetItems sets the list items.
func (*VirtualList) SetViewport ¶
func (l *VirtualList) SetViewport(height, width int)
SetViewport sets the viewport dimensions.
func (*VirtualList) TotalHeight ¶
func (l *VirtualList) TotalHeight() int
TotalHeight returns the total height of all items.
func (*VirtualList) VisibleItems ¶
func (l *VirtualList) VisibleItems() []VisibleItem
VisibleItems returns the items visible in the current viewport.
type VisibleItem ¶
type VisibleItem struct {
Index int
Item ListItem
Y int // Y position in viewport
Height int // Visible height (may be clipped)
OffsetY int // Y offset within item (for partial visibility)
IsSelected bool
TotalHeight int // Total height of the item
}
VisibleItem represents an item visible in the viewport.