Fyne API "widget.List"

widget.List


import "fyne.io/fyne/v2/widget"

Usage

type List

type List struct {
	BaseWidget

	Length       func() int                                  `json:"-"`
	CreateItem   func() fyne.CanvasObject                    `json:"-"`
	UpdateItem   func(id ListItemID, item fyne.CanvasObject) `json:"-"`
	OnSelected   func(id ListItemID)                         `json:"-"`
	OnUnselected func(id ListItemID)                         `json:"-"`
}

List is a widget that pools list items for performance and lays the items out in a vertical direction inside of a scroller. List requires that all items are the same size.

Since: 1.4

func NewList

func NewList(length func() int, createItem func() fyne.CanvasObject, updateItem func(ListItemID, fyne.CanvasObject)) *List

NewList creates and returns a list widget for displaying items in a vertical layout with scrolling and caching for performance.

Since: 1.4

func NewListWithData

func NewListWithData(data binding.DataList, createItem func() fyne.CanvasObject, updateItem func(binding.DataItem, fyne.CanvasObject)) *List

NewListWithData creates a new list widget that will display the contents of the provided data.

Since: 2.0

func (*List) CreateRenderer

func (l *List) CreateRenderer() fyne.WidgetRenderer

CreateRenderer is a private method to Fyne which links this widget to its renderer.

func (*List) MinSize

func (l *List) MinSize() fyne.Size

MinSize returns the size that this widget should not shrink below.

func (*List) Resize

func (l *List) Resize(s fyne.Size)

Resize is called when this list should change size. We refresh to ensure invisible items are drawn.

func (*List) ScrollTo

func (l *List) ScrollTo(id ListItemID)

ScrollTo scrolls to the item represented by id

Since: 2.1

func (*List) ScrollToBottom

func (l *List) ScrollToBottom()

ScrollToBottom scrolls to the end of the list

Since: 2.1

func (*List) ScrollToTop

func (l *List) ScrollToTop()

ScrollToTop scrolls to the start of the list

Since: 2.1

func (*List) Select

func (l *List) Select(id ListItemID)

Select add the item identified by the given ID to the selection.

func (*List) Unselect

func (l *List) Unselect(id ListItemID)

Unselect removes the item identified by the given ID from the selection.

func (*List) UnselectAll

func (l *List) UnselectAll()

UnselectAll removes all items from the selection.

Since: 2.1