use gtk4::prelude::*;
use gtk4::{Box as GtkBox, Entry, Label, Orientation, Align};
pub fn create_entry(label_text: &str, placeholder: Option<&str>) -> (GtkBox, Entry) {
let box_container = GtkBox::builder()
.orientation(Orientation::Horizontal)
.spacing(6)
.build();
let label = Label::builder()
.label(label_text)
.halign(Align::Start)
.valign(Align::Center)
.margin_start(8)
.margin_end(8)
.build();
let entry = Entry::builder()
.hexpand(true)
.placeholder_text(placeholder.unwrap_or(""))
.build();
box_container.append(&label);
box_container.append(&entry);
(box_container, entry)
}
pub fn create_password_entry(label_text: &str, placeholder: Option<&str>) -> (GtkBox, Entry) {
let (box_container, entry) = create_entry(label_text, placeholder);
entry.set_visibility(false);
entry.set_invisible_char(Some('*'));
(box_container, entry)
}