Add support for a generic Element in Tooltip

This commit is contained in:
jhannyj 2024-02-01 21:23:18 -05:00 committed by Héctor Ramón Jiménez
parent 073466708e
commit 6bafdc4b3c
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
2 changed files with 18 additions and 38 deletions

View file

@ -123,20 +123,20 @@ where
Button::new(content)
}
/// Creates a new [`Tooltip`] with the provided content, tooltip text, and [`tooltip::Position`].
/// Creates a new [`Tooltip`] with the provided content, tooltip element, and [`tooltip::Position`].
///
/// [`Tooltip`]: crate::Tooltip
/// [`tooltip::Position`]: crate::tooltip::Position
pub fn tooltip<'a, Message, Theme, Renderer>(
content: impl Into<Element<'a, Message, Theme, Renderer>>,
tooltip: impl ToString,
tooltip: impl Into<Element<'a, Message, Theme, Renderer>>,
position: tooltip::Position,
) -> crate::Tooltip<'a, Message, Theme, Renderer>
where
Theme: container::StyleSheet + text::StyleSheet,
Renderer: core::text::Renderer,
{
Tooltip::new(content, tooltip.to_string(), position)
Tooltip::new(content, tooltip, position)
}
/// Creates a new [`Text`] widget with the provided content.