Fyne API "widget.List"


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


type List

type List struct {

	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) FocusGained

func (l *List) FocusGained()

FocusGained is called after this List has gained focus.

Implements: fyne.Focusable

func (*List) FocusLost

func (l *List) FocusLost()

FocusLost is called after this List has lost focus.

Implements: fyne.Focusable

func (*List) MinSize

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

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

func (*List) RefreshItem

func (l *List) RefreshItem(id ListItemID)

RefreshItem refreshes a single item, specified by the item ID passed in.

Since: 2.4

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) SetItemHeight

func (l *List) SetItemHeight(id ListItemID, height float32)

SetItemHeight supports changing the height of the specified list item. Items normally take the height of the template returned from the CreateItem callback. The height parameter uses the same units as a fyne.Size type and refers to the internal content height not including the divider size.

Since: 2.3

func (*List) TypedKey

func (l *List) TypedKey(event *fyne.KeyEvent)

TypedKey is called if a key event happens while this List is focused.

Implements: fyne.Focusable

func (*List) TypedRune

func (l *List) TypedRune(_ rune)

TypedRune is called if a text event happens while this List is focused.

Implements: fyne.Focusable

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