Something went wrong. Try again.
Cross-platform and non-web GUI library for 🦀 Rust powered by 🎨 Skia. freyaui.dev
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162#![cfg_attr( all(not(debug_assertions), target_os = "windows"), windows_subsystem = "windows")]use freya::prelude::*;
fn main() { launch(LaunchConfig::new().with_window(WindowConfig::new(app)))}
fn app() -> impl IntoElement { rect() .width(Size::fill()) .height(Size::fill()) .child( VirtualScrollView::new(|item, _| { rect() .key(item.index) .height(Size::px(item.size)) .padding(4.) .child( rect() .width(Size::fill()) .height(Size::fill()) .padding(4.) .corner_radius(8.) .color((255, 255, 255)) .background((0, 119, 182)) .child(format!("Item {}", item.index)), ) .into() }) .length(300usize) .item_size(50.) .height(Size::percent(50.)), ) .child( VirtualScrollView::new(|item, _| { rect() .key(item.index) .width(Size::px(item.size)) .padding(4.) .child( rect() .width(Size::fill()) .height(Size::fill()) .center() .padding(4.) .corner_radius(8.) .color((255, 255, 255)) .background((202, 103, 2)) .child(format!("Item {}", item.index)), ) .into() }) .direction(Direction::horizontal()) .length(300usize) .item_size(|index: usize| if index.is_multiple_of(2) { 140. } else { 80. }) .height(Size::percent(50.)), )}