Skip to main content

virtual_stack

Function virtual_stack 

Source
pub fn virtual_stack<T, IF, I, KF, K, VF, V>(
    each_fn: IF,
    key_fn: KF,
    view_fn: VF,
) -> VirtualStack<T>
where T: 'static, IF: Fn() -> I + 'static, I: VirtualVector<T>, KF: Fn(&T) -> K + 'static, K: Eq + Hash + 'static, VF: Fn(T) -> V + 'static, V: IntoView + 'static,
Expand description

A View that lazily loads items as they appear in a scroll view.

ยงExample

use floem::prelude::*;

let _list = VirtualStack::new(move || 1..=1000000)
    .style(|s| {
        s.flex_col().class(LabelClass, |s| {
            s.padding_vert(2.5).width_full().justify_center()
        })
    })
    .scroll()
    .style(|s| s.size(200., 500.).border(1.0));