lazy

package
v0.1.122 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 23, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LazyColumn

func LazyColumn(content func(LazyListScope), options ...LazyListOption) compose.Composable

LazyColumn is a vertically scrolling list that only composes and lays out currently visible items. Note: Current implementation purely implements Lazy Layout (eager composition).

func LazyHorizontalGrid

func LazyHorizontalGrid(
	rows GridCells,
	content func(LazyGridScope),
	options ...LazyGridOption,
) compose.Composable

LazyHorizontalGrid is a horizontally scrolling grid that lays out items in rows. The rows parameter determines how items are arranged vertically.

func LazyRow

func LazyRow(content func(LazyListScope), options ...LazyListOption) compose.Composable

LazyRow is a horizontally scrolling list that only composes and lays out currently visible items. Note: Current implementation purely implements Lazy Layout (eager composition).

func LazyVerticalGrid

func LazyVerticalGrid(
	columns GridCells,
	content func(LazyGridScope),
	options ...LazyGridOption,
) compose.Composable

LazyVerticalGrid is a vertically scrolling grid that lays out items in columns. The columns parameter determines how items are arranged horizontally.

Types

type C

type C = layout.Context

type D

type D = layout.Dimensions

type GridCells

type GridCells interface {
	// contains filtered or unexported methods
}

GridCells determines how cells should be arranged in a grid's cross-axis.

func Adaptive

func Adaptive(minSize int) GridCells

Adaptive creates a GridCells that calculates the number of columns/rows dynamically so that each cell is at least minSize dp wide/tall. The actual size will be larger to use all available space.

func Fixed

func Fixed(count int) GridCells

Fixed creates a GridCells that specifies a fixed number of columns (for LazyVerticalGrid) or rows (for LazyHorizontalGrid).

type LazyGridOption

type LazyGridOption func(*LazyGridOptions)

LazyGridOption is a functional option for configuring lazy grids.

func WithGridModifier

func WithGridModifier(m ui.Modifier) LazyGridOption

WithGridModifier applies a modifier to the grid.

func WithGridScrollbar added in v0.1.114

func WithGridScrollbar(enabled bool) LazyGridOption

func WithGridState

func WithGridState(state *LazyGridState) LazyGridOption

WithGridState sets the grid state for scroll position management.

type LazyGridOptions

type LazyGridOptions struct {
	Modifier  ui.Modifier
	State     *LazyGridState
	Scrollbar bool
}

LazyGridOptions holds configuration for a lazy grid.

func DefaultLazyGridOptions

func DefaultLazyGridOptions() LazyGridOptions

DefaultLazyGridOptions returns the default options for a lazy grid.

type LazyGridScope

type LazyGridScope interface {
	// Item adds a single item to the grid.
	Item(key any, content compose.Composable)
	// Items adds multiple items to the grid using a count and item factory.
	Items(count int, key func(index int) any, itemContent func(index int) compose.Composable)
}

LazyGridScope is a DSL scope for defining grid items in a lazy grid.

type LazyGridState

type LazyGridState struct {
	List widget.List
}

LazyGridState holds the state for a lazy grid, including scroll position.

func NewLazyGridState

func NewLazyGridState() *LazyGridState

NewLazyGridState creates a new LazyGridState with default configuration.

func RememberLazyGridState

func RememberLazyGridState(c compose.Composer) *LazyGridState

RememberLazyGridState creates or retrieves a remembered LazyGridState.

type LazyListOption

type LazyListOption func(*LazyListOptions)

func WithModifier

func WithModifier(m ui.Modifier) LazyListOption

func WithScrollbar added in v0.1.114

func WithScrollbar(enabled bool) LazyListOption

func WithState

func WithState(state *LazyListState) LazyListOption

type LazyListOptions

type LazyListOptions struct {
	Modifier  ui.Modifier
	State     *LazyListState
	Scrollbar bool // enable scrollbar rendering
}

func DefaultLazyListOptions

func DefaultLazyListOptions() LazyListOptions

type LazyListScope

type LazyListScope interface {
	Item(key any, content compose.Composable)
	Items(count int, key func(index int) any, itemContent func(index int) compose.Composable)
	StickyHeader(key any, content compose.Composable)
}

type LazyListState

type LazyListState struct {
	List widget.List
}

func NewLazyListState

func NewLazyListState() *LazyListState

func RememberLazyListState

func RememberLazyListState(c compose.Composer) *LazyListState

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL