summaryrefslogtreecommitdiffstats
path: root/native/src/widget/column.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/column.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 'native/src/widget/column.rs')
-rw-r--r--native/src/widget/column.rs15
1 files changed, 8 insertions, 7 deletions
diff --git a/native/src/widget/column.rs b/native/src/widget/column.rs
index d7f0365a..52a2e80c 100644
--- a/native/src/widget/column.rs
+++ b/native/src/widget/column.rs
@@ -5,7 +5,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::u32;
@@ -14,7 +15,7 @@ use std::u32;
#[allow(missing_debug_implementations)]
pub struct Column<'a, Message, Renderer> {
spacing: u16,
- padding: u16,
+ padding: Padding,
width: Length,
height: Length,
max_width: u32,
@@ -35,7 +36,7 @@ impl<'a, Message, Renderer> Column<'a, Message, Renderer> {
) -> Self {
Column {
spacing: 0,
- padding: 0,
+ padding: Padding::ZERO,
width: Length::Shrink,
height: Length::Shrink,
max_width: u32::MAX,
@@ -55,9 +56,9 @@ impl<'a, Message, Renderer> Column<'a, Message, Renderer> {
self
}
- /// Sets the padding of the [`Column`].
- pub fn padding(mut self, units: u16) -> Self {
- self.padding = units;
+ /// Sets the [`Padding`] of the [`Column`].
+ pub fn padding<P: Into<Padding>>(mut self, padding: P) -> Self {
+ self.padding = padding.into();
self
}
@@ -129,7 +130,7 @@ where
layout::flex::Axis::Vertical,
renderer,
&limits,
- self.padding as f32,
+ self.padding,
self.spacing as f32,
self.align_items,
&self.children,