Hide Text
as an implementation detail of Tooltip
This commit is contained in:
parent
5e2743361b
commit
2736e4ca35
@ -110,11 +110,11 @@ fn tooltip<'a>(
|
|||||||
.on_press(Message)
|
.on_press(Message)
|
||||||
.width(Length::Fill)
|
.width(Length::Fill)
|
||||||
.height(Length::Fill),
|
.height(Length::Fill),
|
||||||
Text::new("Tooltip"),
|
"Tooltip",
|
||||||
position,
|
position,
|
||||||
)
|
)
|
||||||
.gap(10)
|
.gap(5)
|
||||||
.padding(20)
|
.padding(10)
|
||||||
.style(style::Tooltip)
|
.style(style::Tooltip)
|
||||||
.into()
|
.into()
|
||||||
}
|
}
|
||||||
|
@ -30,12 +30,12 @@ where
|
|||||||
/// [`Tooltip`]: struct.Tooltip.html
|
/// [`Tooltip`]: struct.Tooltip.html
|
||||||
pub fn new(
|
pub fn new(
|
||||||
content: impl Into<Element<'a, Message, Renderer>>,
|
content: impl Into<Element<'a, Message, Renderer>>,
|
||||||
tooltip: Text<Renderer>,
|
tooltip: impl ToString,
|
||||||
position: Position,
|
position: Position,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
Tooltip {
|
Tooltip {
|
||||||
content: content.into(),
|
content: content.into(),
|
||||||
tooltip,
|
tooltip: Text::new(tooltip.to_string()),
|
||||||
position,
|
position,
|
||||||
style: Default::default(),
|
style: Default::default(),
|
||||||
gap: 0,
|
gap: 0,
|
||||||
@ -43,12 +43,17 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Sets the style of the [`Tooltip`].
|
/// Sets the size of the text of the [`Tooltip`].
|
||||||
pub fn style(
|
pub fn size(mut self, size: u16) -> Self {
|
||||||
mut self,
|
self.tooltip = self.tooltip.size(size);
|
||||||
style: impl Into<<Renderer as container::Renderer>::Style>,
|
self
|
||||||
) -> Self {
|
}
|
||||||
self.style = style.into();
|
|
||||||
|
/// Sets the font of the [`Tooltip`].
|
||||||
|
///
|
||||||
|
/// [`Font`]: Renderer::Font
|
||||||
|
pub fn font(mut self, font: impl Into<Renderer::Font>) -> Self {
|
||||||
|
self.tooltip = self.tooltip.font(font);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,6 +68,15 @@ where
|
|||||||
self.padding = padding;
|
self.padding = padding;
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Sets the style of the [`Tooltip`].
|
||||||
|
pub fn style(
|
||||||
|
mut self,
|
||||||
|
style: impl Into<<Renderer as container::Renderer>::Style>,
|
||||||
|
) -> Self {
|
||||||
|
self.style = style.into();
|
||||||
|
self
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The position of the tooltip. Defaults to following the cursor.
|
/// The position of the tooltip. Defaults to following the cursor.
|
||||||
|
Loading…
Reference in New Issue
Block a user