diff options
author | 2023-02-17 16:53:02 +0100 | |
---|---|---|
committer | 2023-02-17 16:53:02 +0100 | |
commit | 7dc1fb488ddbd12519571b51d75ae0c28875911d (patch) | |
tree | 92590830b23bb714ec8024766fef7273b041bbf3 /native/src/widget/button.rs | |
parent | f75e0202575ca6e3ebf7d817eecbf51e198506fd (diff) | |
parent | fd1408693322f5bfdaee7f27bd098808658d7310 (diff) | |
download | iced-7dc1fb488ddbd12519571b51d75ae0c28875911d.tar.gz iced-7dc1fb488ddbd12519571b51d75ae0c28875911d.tar.bz2 iced-7dc1fb488ddbd12519571b51d75ae0c28875911d.zip |
Merge pull request #1711 from iced-rs/feature/generic-pixel-units
Generic pixel units
Diffstat (limited to 'native/src/widget/button.rs')
-rw-r--r-- | native/src/widget/button.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/native/src/widget/button.rs b/native/src/widget/button.rs index b4276317..39387173 100644 --- a/native/src/widget/button.rs +++ b/native/src/widget/button.rs @@ -76,20 +76,20 @@ where on_press: None, width: Length::Shrink, height: Length::Shrink, - padding: Padding::new(5), + padding: Padding::new(5.0), style: <Renderer::Theme as StyleSheet>::Style::default(), } } /// Sets the width of the [`Button`]. - pub fn width(mut self, width: Length) -> Self { - self.width = width; + pub fn width(mut self, width: impl Into<Length>) -> Self { + self.width = width.into(); self } /// Sets the height of the [`Button`]. - pub fn height(mut self, height: Length) -> Self { - self.height = height; + pub fn height(mut self, height: impl Into<Length>) -> Self { + self.height = height.into(); self } @@ -434,7 +434,7 @@ pub fn layout<Renderer>( let padding = padding.fit(content.size(), limits.max()); let size = limits.pad(padding).resolve(content.size()).pad(padding); - content.move_to(Point::new(padding.left.into(), padding.top.into())); + content.move_to(Point::new(padding.left, padding.top)); layout::Node::with_children(size, vec![content]) } |