add password field

This commit is contained in:
2026-11-01 17:26:30 +07:00
parent b2ce60f0e6
commit acf907461b
9 changed files with 430 additions and 56 deletions
+8
View File
@@ -45,6 +45,7 @@ struct Gallery {
toggle_pressed: bool,
volume: f32,
input_state: Entity<InputState>,
password_state: Entity<InputState>,
popover_open: bool,
menu_open: bool,
strategy: Option<Strategy>,
@@ -350,6 +351,10 @@ impl Render for Gallery {
Input::new("gallery-input", self.input_state.clone())
.placeholder("Type here…"),
)
.child(
Input::new("gallery-password", self.password_state.clone())
.placeholder("Password"),
)
.child(
div()
.text_xs()
@@ -1446,6 +1451,8 @@ fn main() {
application().with_assets(IconAssets).run(|cx: &mut App| {
gpui_native_core::init(cx);
let input_state = InputState::new(cx);
let password_state = InputState::new(cx);
password_state.update(cx, |state, cx| state.set_password(true, cx));
let bounds = Bounds::centered(None, size(px(720.0), px(560.0)), cx);
if let Err(err) = cx.open_window(
WindowOptions {
@@ -1482,6 +1489,7 @@ fn main() {
toggle_pressed: false,
volume: 40.0,
input_state,
password_state,
popover_open: false,
menu_open: false,
strategy: Some(Strategy::Curated),