summaryrefslogtreecommitdiff
path: root/src/widget.rs
blob: 859d25ed28812556c5da0c539c38eda58211c38b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
use iced::widget::{self, container, text, tooltip};
use material_theme::Theme;

use crate::types::Element;

pub mod tip {
    pub use super::tooltip::Position;
}

pub fn tip<'a, Message: 'a>(
    target: impl Into<Element<'a, Message>>,
    tip: &'a str,
    position: tip::Position,
) -> Element<'a, Message> {
    tooltip(
        target,
        container(text(tip).size(14)).padding(5).style(|theme| {
            let base = material_theme::container::surface_container_low(theme);
            container::Style {
                border: iced::border::rounded(4),
                ..base
            }
        }),
        position,
    )
    .into()
}

pub type Text<'a> = widget::Text<'a, Theme>;