add sizable trait

This commit is contained in:
2026-10-29 07:56:23 +07:00
parent 3808b1519f
commit 1b29c2c940
19 changed files with 442 additions and 69 deletions
+13 -3
View File
@@ -7,7 +7,7 @@ use gpui::{
use gpui_native_core::avatar::Avatar;
use gpui_native_core::button::{Button, ButtonVariant};
use gpui_native_core::checkbox::Checkbox;
use gpui_native_core::common::{h_flex, v_flex};
use gpui_native_core::common::{Sizable as _, h_flex, v_flex};
use gpui_native_core::input::{Input, InputState};
use gpui_native_core::link::Link;
use gpui_native_core::progress::Progress;
@@ -206,6 +206,14 @@ impl Render for Gallery {
.icon(IconRole::Folder),
),
)
.child(
h_flex()
.items_center()
.gap_2()
.child(Button::new("gallery-button-sm").label("Small").small())
.child(Button::new("gallery-button-md").label("Medium"))
.child(Button::new("gallery-button-lg").label("Large").large()),
)
.child(
div()
.text_xs()
@@ -455,8 +463,8 @@ impl Render for Gallery {
.name("Ada Lovelace")
.picture(Some("https://example.com/missing.png")),
)
.child(Avatar::new("grace@reya.info").name("Grace Hopper"))
.child(Avatar::new("bot@reya.info")),
.child(Avatar::new("grace@reya.info").name("Grace Hopper").small())
.child(Avatar::new("desk@reya.info").name("Help Desk").large()),
),
)
.child(
@@ -602,10 +610,12 @@ fn main() {
},
|window, cx| {
Theme::sync_from_window(window, cx);
Theme::sync_window_rem_size(window, cx);
// Detached on purpose: the subscription lives as long as the window.
window
.observe_window_appearance(|window, cx| {
Theme::sync_from_window(window, cx);
Theme::sync_window_rem_size(window, cx);
cx.refresh_windows();
})
.detach();