🌈 Create new beautiful Compose Gradients with our new wesite ->
Interface

PinnableContainer

Represents a container which can be pinned when the content of this container is important.

Source set: Common
public interface PinnableContainer

Represents a container which can be pinned when the content of this container is important.

For example, each item of lazy list represents one PinnableContainer, and if this container is pinned, this item will not be disposed when scrolled out of the viewport.

Pinning a currently focused item so the focus is not lost is one of the examples when this functionality can be useful.

Functions

pin

Source set: Common
public fun pin(): PinnedHandle

Allows to pin this container when the associated content is considered important.

For example, if this PinnableContainer is an item of lazy list pinning will mean this item will not be disposed when scrolled out of the viewport.

Don't forget to call PinnedHandle.release when this content is not important anymore.

Members

PinnedHandle

Source set: Common
public interface PinnedHandle

This is an object returned by pin which allows to release the pinning.

Functions

release

Source set: Common
public fun release()

Releases the pin.

For example, if this PinnableContainer is an item of lazy list releasing the pinning will allow lazy list to stop composing the item when it is not visible.