Explain each preference in a hover tooltip
This commit is contained in:
@@ -16,8 +16,8 @@ use crate::model::{
|
||||
use crate::settings::{GIB, REASONING_MODES};
|
||||
use iced::theme::{Palette, palette};
|
||||
use iced::widget::{
|
||||
Button, Space, Svg, button, checkbox, column, container, horizontal_rule, markdown, opaque,
|
||||
pick_list, progress_bar, row, scrollable, stack, svg, text, text_input,
|
||||
Button, Space, Svg, Tooltip, button, checkbox, column, container, horizontal_rule, markdown,
|
||||
opaque, pick_list, progress_bar, row, scrollable, stack, svg, text, text_input, tooltip,
|
||||
};
|
||||
use iced::{Alignment, Background, Border, Color, Element, Length, Padding, Theme, window};
|
||||
use std::collections::VecDeque;
|
||||
@@ -521,10 +521,11 @@ impl App {
|
||||
|
||||
fn preference_input_row<'a>(
|
||||
label: &'a str,
|
||||
description: &'a str,
|
||||
input: iced::widget::TextInput<'a, Message>,
|
||||
) -> Element<'a, Message> {
|
||||
row![
|
||||
text(label).size(13).width(Length::Fill),
|
||||
hint(text(label).size(13).width(Length::Fill), description),
|
||||
input.width(240).padding(9),
|
||||
]
|
||||
.spacing(12)
|
||||
@@ -532,6 +533,19 @@ fn preference_input_row<'a>(
|
||||
.into()
|
||||
}
|
||||
|
||||
/// Explains a setting on hover, so the title does not have to carry the detail.
|
||||
fn hint<'a>(title: impl Into<Element<'a, Message>>, description: &'a str) -> Tooltip<'a, Message> {
|
||||
tooltip(
|
||||
title,
|
||||
container(text(description).size(12))
|
||||
.padding(10)
|
||||
.max_width(320)
|
||||
.style(preference_group_style),
|
||||
tooltip::Position::Bottom,
|
||||
)
|
||||
.gap(6)
|
||||
}
|
||||
|
||||
fn preference_group<'a>(
|
||||
title: &'a str,
|
||||
content: impl Into<Element<'a, Message>>,
|
||||
|
||||
Reference in New Issue
Block a user