diff --git a/crates/ui-patterns/src/patterns/form_dialogs/about.rs b/crates/ui-patterns/src/patterns/form_dialogs/about.rs index a6ae78ca1..2a11374e8 100644 --- a/crates/ui-patterns/src/patterns/form_dialogs/about.rs +++ b/crates/ui-patterns/src/patterns/form_dialogs/about.rs @@ -118,7 +118,8 @@ pub enum AboutLayout { #[default] Centred, /// From the start edge, one item to a line: the app's name as a heading, the version, the blurb, the community - /// link and then the other links in their order, the built-with line as a faint caption; Close closes. + /// link and then the other links in their order, the built-with line as a faint caption, the links set apart from + /// the lines above and below them by the item gap; Close closes. Listed, } @@ -386,10 +387,14 @@ impl Shown<'_> { fn about(&self, ui: &mut Ui, link: &RefCell>) { let (words, info) = (self.words, self.info); if self.layout == AboutLayout::Listed { - Stack::new().show(ui, |ui, _| { - Text::new(info.app_name.clone()).role(TypeRole::Heading).show(ui); - Text::new(words.version.fill(&[("version", info.version.as_str())])).show(ui); - Text::new(info.blurb.clone()).show(ui); + // Three blocks set apart by the item gap, as WordCraft's About spaced them: the name, version and blurb; the + // links; the built-with line. + Stack::new().gap(Gap::Item).show(ui, |ui, _| { + Stack::new().show(ui, |ui, _| { + Text::new(info.app_name.clone()).role(TypeRole::Heading).show(ui); + Text::new(words.version.fill(&[("version", info.version.as_str())])).show(ui); + Text::new(info.blurb.clone()).show(ui); + }); Stack::new().show(ui, |ui, _| { for (at, item) in info.community.iter().chain(info.links.iter()).enumerate() { if clicked(&Link::new(item.label.clone()).id_salt(("link", at)).show(ui)) { diff --git a/crates/ui-patterns/src/patterns/form_dialogs/param.rs b/crates/ui-patterns/src/patterns/form_dialogs/param.rs index 33288fbb2..05a72184f 100644 --- a/crates/ui-patterns/src/patterns/form_dialogs/param.rs +++ b/crates/ui-patterns/src/patterns/form_dialogs/param.rs @@ -476,6 +476,8 @@ pub(crate) struct RowOptions { max_chars: Option, /// Whether a text row shows its text in the monospace face ([`Param::mono`]). mono: bool, + /// The width a text row's field asks for, in characters ([`Param::field_chars`]). + field_chars: Option, units: Option, /// The ids of the options a choice row shows disabled. disabled_options: Vec, @@ -782,6 +784,16 @@ impl Param { self } + /// The width of a [`ParamKind::Text`] row's field, in characters (`TextField::width_chars`): the field asks for + /// `chars` times the width of a `0` in its face instead of the field length, so one row of a form can be wider or + /// narrower than the others (a watermark's text against a short name). A row that lacks room still narrows it. + /// `0` keeps the field length; other kinds, and a text row with a Browse button, are unchanged. + #[must_use] + pub fn field_chars(mut self, chars: u16) -> Self { + self.options.get_or_insert_default().field_chars = (chars > 0).then_some(chars); + self + } + /// Hover text for the whole row, label and control, of any kind. #[must_use] pub fn tooltip(mut self, text: impl Into