add scrollarea

This commit is contained in:
2026-10-29 19:23:06 +07:00
parent 4ae6a23cd9
commit cc22baca6e
12 changed files with 388 additions and 10 deletions
+12 -3
View File
@@ -13,6 +13,7 @@ use gpui_native_core::link::Link;
use gpui_native_core::popover::Popover;
use gpui_native_core::progress::Progress;
use gpui_native_core::radio::{Radio, RadioGroup};
use gpui_native_core::scroll_area::ScrollArea;
use gpui_native_core::slider::Slider;
use gpui_native_core::switch::Switch;
use gpui_native_core::toggle::Toggle;
@@ -29,6 +30,7 @@ struct Gallery {
volume: f32,
input_state: Entity<InputState>,
popover_open: bool,
scroll: gpui::ScrollHandle,
}
impl Render for Gallery {
@@ -98,8 +100,7 @@ impl Render for Gallery {
("destructive", ButtonVariant::Destructive),
];
div()
.size_full()
let content = div()
.font_family(".SystemUIFont")
.bg(colors.background)
.text_color(colors.foreground)
@@ -582,7 +583,14 @@ impl Render for Gallery {
.map(|role| icon(*role).size(20.0).color(colors.foreground)),
),
),
)
);
// The whole gallery scrolls, demonstrating the scroll area at the
// page level: the thumb floats over the window's content.
ScrollArea::new("gallery-scroll")
.handle(self.scroll.clone())
.size_full()
.child(content)
}
}
@@ -671,6 +679,7 @@ fn main() {
volume: 40.0,
input_state,
popover_open: false,
scroll: gpui::ScrollHandle::new(),
})
},
) {