Skip to main content

uzor_core/containers/
scroll.rs

1use crate::layout::types::*;
2use crate::types::state::WidgetId;
3
4pub struct ScrollView;
5
6impl ScrollView {
7    #[allow(clippy::new_ret_no_self)]
8    pub fn new(id: impl Into<WidgetId>) -> LayoutNode {
9        let mut flags = LayoutFlags::CLIP_CONTENT;
10        flags.insert(LayoutFlags::SCROLL_Y);
11        
12        LayoutNode::new(id)
13            .with_style(LayoutStyle {
14                display: Display::Flex, // Wrapper acts as flex container for content
15                direction: FlexDirection::Column,
16                ..Default::default()
17            })
18            .with_flags(flags)
19    }
20}
21
22pub struct Modal;
23impl Modal {
24    #[allow(clippy::new_ret_no_self)]
25    pub fn new(id: impl Into<WidgetId>) -> LayoutNode {
26        // Modal is usually a full-screen overlay Stack
27        LayoutNode::new(id)
28            .with_style(LayoutStyle {
29                display: Display::Stack,
30                position: Position::Absolute,
31                width: SizeSpec::Fill,
32                height: SizeSpec::Fill,
33                z_index: 1000, // High Z-index
34                ..Default::default()
35            })
36            .with_kind(LayoutKind::Overlay)
37    }
38}