widget.GridWrap
import "fyne.io/fyne/v2/widget"Usage
type GridWrap
type GridWrap struct {
BaseWidget
// Length is a callback for returning the number of items in the GridWrap.
Length func() int `json:"-"`
// CreateItem is a callback invoked to create a new widget to render
// an item in the GridWrap.
CreateItem func() fyne.CanvasObject `json:"-"`
// UpdateItem is a callback invoked to update a GridWrap item widget
// to display a new item in the list. The UpdateItem callback should
// only update the given item, it should not invoke APIs that would
// change other properties of the GridWrap itself.
UpdateItem func(id GridWrapItemID, item fyne.CanvasObject) `json:"-"`
// OnSelected is a callback to be notified when a given item
// in the GridWrap has been selected.
OnSelected func(id GridWrapItemID) `json:"-"`
// OnSelected is a callback to be notified when a given item
// in the GridWrap has been unselected.
OnUnselected func(id GridWrapItemID) `json:"-"`
}GridWrap is a widget with an API very similar to widget.List, that lays out items in a scrollable wrapping grid similar to container.NewGridWrap. It caches and reuses widgets for performance.
2.4func NewGridWrap
func NewGridWrap(length func() int, createItem func() fyne.CanvasObject, updateItem func(GridWrapItemID, fyne.CanvasObject)) *GridWrapNewGridWrap creates and returns a GridWrap widget for displaying items in a wrapping grid layout with scrolling and caching for performance.
2.4func NewGridWrapWithData
func NewGridWrapWithData(data binding.DataList, createItem func() fyne.CanvasObject, updateItem func(binding.DataItem, fyne.CanvasObject)) *GridWrapNewGridWrapWithData creates a new GridWrap widget that will display the contents of the provided data.
2.4func (*GridWrap) ColumnCount
func (l *GridWrap) ColumnCount() intColumnCount returns the number of columns that are/will be shown in this GridWrap, based on the widget’s current width.
2.5func (*GridWrap) CreateRenderer
func (l *GridWrap) CreateRenderer() fyne.WidgetRendererCreateRenderer is a private method to Fyne which links this widget to its renderer.
func (*GridWrap) FocusGained
func (l *GridWrap) FocusGained()FocusGained is called after this GridWrap has gained focus.
func (*GridWrap) FocusLost
func (l *GridWrap) FocusLost()FocusLost is called after this GridWrap has lost focus.
func (*GridWrap) GetScrollOffset
func (l *GridWrap) GetScrollOffset() float32GetScrollOffset returns the current scroll offset position
func (*GridWrap) MinSize
func (l *GridWrap) MinSize() fyne.SizeMinSize returns the size that this widget should not shrink below.
func (*GridWrap) RefreshItem
func (l *GridWrap) RefreshItem(id GridWrapItemID)RefreshItem refreshes a single item, specified by the item ID passed in.
2.4func (*GridWrap) Resize
func (l *GridWrap) Resize(s fyne.Size)Resize is called when this GridWrap should change size. We refresh to ensure invisible items are drawn.
func (*GridWrap) ScrollTo
func (l *GridWrap) ScrollTo(id GridWrapItemID)ScrollTo scrolls to the item represented by id
func (*GridWrap) ScrollToBottom
func (l *GridWrap) ScrollToBottom()ScrollToBottom scrolls to the end of the list
func (*GridWrap) ScrollToOffset
func (l *GridWrap) ScrollToOffset(offset float32)ScrollToOffset scrolls the list to the given offset position
func (*GridWrap) ScrollToTop
func (l *GridWrap) ScrollToTop()ScrollToTop scrolls to the start of the list
func (*GridWrap) Select
func (l *GridWrap) Select(id GridWrapItemID)Select adds the item identified by the given ID to the selection.
func (*GridWrap) TypedKey
func (l *GridWrap) TypedKey(event *fyne.KeyEvent)TypedKey is called if a key event happens while this GridWrap is focused.
func (*GridWrap) TypedRune
func (l *GridWrap) TypedRune(_ rune)TypedRune is called if a text event happens while this GridWrap is focused.
func (*GridWrap) Unselect
func (l *GridWrap) Unselect(id GridWrapItemID)Unselect removes the item identified by the given ID from the selection.
func (*GridWrap) UnselectAll
func (l *GridWrap) UnselectAll()UnselectAll removes all items from the selection.