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)
 | 
			
		||||
        .width(Length::Fill)
 | 
			
		||||
        .height(Length::Fill),
 | 
			
		||||
        Text::new("Tooltip"),
 | 
			
		||||
        "Tooltip",
 | 
			
		||||
        position,
 | 
			
		||||
    )
 | 
			
		||||
    .gap(10)
 | 
			
		||||
    .padding(20)
 | 
			
		||||
    .gap(5)
 | 
			
		||||
    .padding(10)
 | 
			
		||||
    .style(style::Tooltip)
 | 
			
		||||
    .into()
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -30,12 +30,12 @@ where
 | 
			
		||||
    /// [`Tooltip`]: struct.Tooltip.html
 | 
			
		||||
    pub fn new(
 | 
			
		||||
        content: impl Into<Element<'a, Message, Renderer>>,
 | 
			
		||||
        tooltip: Text<Renderer>,
 | 
			
		||||
        tooltip: impl ToString,
 | 
			
		||||
        position: Position,
 | 
			
		||||
    ) -> Self {
 | 
			
		||||
        Tooltip {
 | 
			
		||||
            content: content.into(),
 | 
			
		||||
            tooltip,
 | 
			
		||||
            tooltip: Text::new(tooltip.to_string()),
 | 
			
		||||
            position,
 | 
			
		||||
            style: Default::default(),
 | 
			
		||||
            gap: 0,
 | 
			
		||||
@ -43,12 +43,17 @@ where
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /// Sets the style of the [`Tooltip`].
 | 
			
		||||
    pub fn style(
 | 
			
		||||
        mut self,
 | 
			
		||||
        style: impl Into<<Renderer as container::Renderer>::Style>,
 | 
			
		||||
    ) -> Self {
 | 
			
		||||
        self.style = style.into();
 | 
			
		||||
    /// Sets the size of the text of the [`Tooltip`].
 | 
			
		||||
    pub fn size(mut self, size: u16) -> Self {
 | 
			
		||||
        self.tooltip = self.tooltip.size(size);
 | 
			
		||||
        self
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /// 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
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -63,6 +68,15 @@ where
 | 
			
		||||
        self.padding = padding;
 | 
			
		||||
        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.
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user