summaryrefslogtreecommitdiffstats
path: root/native/src/widget/row.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón <hector0193@gmail.com>2021-06-01 19:59:02 +0700
committerLibravatar GitHub <noreply@github.com>2021-06-01 19:59:02 +0700
commitaab2176802b6d745a7eab76ec13762b5b4ddf782 (patch)
tree3d1655b36aa8d7151c878e1879c03c8271a466a5 /native/src/widget/row.rs
parenta9eb591628017caaf7aa9af505d1206f7a143a9a (diff)
parent8a3b71df8b619571ce0a972826cb5a3987b66b3d (diff)
downloadiced-aab2176802b6d745a7eab76ec13762b5b4ddf782.tar.gz
iced-aab2176802b6d745a7eab76ec13762b5b4ddf782.tar.bz2
iced-aab2176802b6d745a7eab76ec13762b5b4ddf782.zip
Merge pull request #630 from blefevre/asymmetric-padding
Add support for asymmetrical padding
Diffstat (limited to '')
-rw-r--r--native/src/widget/row.rs15
1 files changed, 8 insertions, 7 deletions
diff --git a/native/src/widget/row.rs b/native/src/widget/row.rs
index 5634ab12..9ebc9145 100644
--- a/native/src/widget/row.rs
+++ b/native/src/widget/row.rs
@@ -3,7 +3,8 @@ use crate::event::{self, Event};
use crate::layout;
use crate::overlay;
use crate::{
- Align, Clipboard, Element, Hasher, Layout, Length, Point, Rectangle, Widget,
+ Align, Clipboard, Element, Hasher, Layout, Length, Padding, Point,
+ Rectangle, Widget,
};
use std::hash::Hash;
@@ -13,7 +14,7 @@ use std::u32;
#[allow(missing_debug_implementations)]
pub struct Row<'a, Message, Renderer> {
spacing: u16,
- padding: u16,
+ padding: Padding,
width: Length,
height: Length,
max_width: u32,
@@ -34,7 +35,7 @@ impl<'a, Message, Renderer> Row<'a, Message, Renderer> {
) -> Self {
Row {
spacing: 0,
- padding: 0,
+ padding: Padding::ZERO,
width: Length::Shrink,
height: Length::Shrink,
max_width: u32::MAX,
@@ -54,9 +55,9 @@ impl<'a, Message, Renderer> Row<'a, Message, Renderer> {
self
}
- /// Sets the padding of the [`Row`].
- pub fn padding(mut self, units: u16) -> Self {
- self.padding = units;
+ /// Sets the [`Padding`] of the [`Row`].
+ pub fn padding<P: Into<Padding>>(mut self, padding: P) -> Self {
+ self.padding = padding.into();
self
}
@@ -128,7 +129,7 @@ where
layout::flex::Axis::Horizontal,
renderer,
&limits,
- self.padding as f32,
+ self.padding,
self.spacing as f32,
self.align_items,
&self.children,