WARNING: Cushy is in early alpha. This guide doubly so.
Virtual List
The VirtualList
widget allows efficient rendering of long lists of items. It
is restricted to uniform row width and heights to be very efficient.
For a virtual list to be rendered, it needs to be given an item count and a function that creates a widget for a given item index.
#![allow(unused)] fn main() { fn list() -> impl MakeWidget { VirtualList::new(50, |index| format!("Item {index}")).expand() } }
With this information, the VirtualList
will only keep exactly the widgets
needed to display the currently visible rows. The item count can be a
Dynamic<usize>
to allow changing the item count while the list is being
displayed. Additionally, content_watcher()
allows fully
refreshing the contents when a Source
changes or through manual notification.