Use Pixels for size methods

This commit is contained in:
Héctor Ramón Jiménez 2023-02-17 15:56:19 +01:00
parent 67e3da5669
commit 0872d078e2
No known key found for this signature in database
GPG key ID: 140CC052C94F138E
3 changed files with 7 additions and 7 deletions

View file

@ -101,8 +101,8 @@ where
}
/// Sets the size of the [`Radio`] button.
pub fn size(mut self, size: f32) -> Self {
self.size = size;
pub fn size(mut self, size: impl Into<Pixels>) -> Self {
self.size = size.into().0;
self
}

View file

@ -85,8 +85,8 @@ where
}
/// Sets the size of the [`Toggler`].
pub fn size(mut self, size: f32) -> Self {
self.size = size;
pub fn size(mut self, size: impl Into<Pixels>) -> Self {
self.size = size.into().0;
self
}

View file

@ -9,8 +9,8 @@ use crate::widget::container;
use crate::widget::overlay;
use crate::widget::{Text, Tree};
use crate::{
Clipboard, Element, Event, Layout, Length, Padding, Point, Rectangle,
Shell, Size, Vector, Widget,
Clipboard, Element, Event, Layout, Length, Padding, Pixels, Point,
Rectangle, Shell, Size, Vector, Widget,
};
use std::borrow::Cow;
@ -59,7 +59,7 @@ where
}
/// Sets the size of the text of the [`Tooltip`].
pub fn size(mut self, size: u16) -> Self {
pub fn size(mut self, size: impl Into<Pixels>) -> Self {
self.tooltip = self.tooltip.size(size);
self
}