summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2019-11-11 05:37:51 +0100
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2019-11-11 05:37:51 +0100
commitd4d14b68f47e9527554a728ebbba9b840832626a (patch)
treec37dc77445e96d39b119aa1cadb46fa738743795
parentceb02f4a36769c488c2525db2fb73f092a6c2706 (diff)
downloadiced-d4d14b68f47e9527554a728ebbba9b840832626a.tar.gz
iced-d4d14b68f47e9527554a728ebbba9b840832626a.tar.bz2
iced-d4d14b68f47e9527554a728ebbba9b840832626a.zip
Remove `padding` from `Container` for now
-rw-r--r--core/src/widget/container.rs10
-rw-r--r--examples/scroll.rs11
-rw-r--r--native/src/layout/node.rs8
-rw-r--r--native/src/widget/container.rs5
-rw-r--r--web/src/lib.rs2
5 files changed, 13 insertions, 23 deletions
diff --git a/core/src/widget/container.rs b/core/src/widget/container.rs
index dc1aab08..9bc92fe0 100644
--- a/core/src/widget/container.rs
+++ b/core/src/widget/container.rs
@@ -8,7 +8,6 @@ pub struct Container<Element> {
pub height: Length,
pub max_width: u32,
pub max_height: u32,
- pub padding: u16,
pub horizontal_alignment: Align,
pub vertical_alignment: Align,
pub content: Element,
@@ -29,7 +28,6 @@ impl<Element> Container<Element> {
max_height: u32::MAX,
horizontal_alignment: Align::Start,
vertical_alignment: Align::Start,
- padding: 0,
content: content.into(),
}
}
@@ -66,14 +64,6 @@ impl<Element> Container<Element> {
self
}
- /// Sets the padding of the [`Container`].
- ///
- /// [`Container`]: struct.Container.html
- pub fn padding(mut self, units: u16) -> Self {
- self.padding = units;
- self
- }
-
/// Centers the contents in the horizontal axis of the [`Container`].
///
/// [`Container`]: struct.Container.html
diff --git a/examples/scroll.rs b/examples/scroll.rs
index 5a725f0c..98206268 100644
--- a/examples/scroll.rs
+++ b/examples/scroll.rs
@@ -1,6 +1,6 @@
use iced::{
- button, scrollable, Align, Application, Button, Column, Element, Image,
- Justify, Length, Scrollable, Text,
+ button, scrollable, Align, Application, Button, Column, Container, Element,
+ Image, Length, Scrollable, Text,
};
pub fn main() {
@@ -65,11 +65,10 @@ impl Application for Example {
.border_radius(5),
);
- Column::new()
+ Container::new(content)
+ .width(Length::Fill)
.height(Length::Fill)
- .justify_content(Justify::Center)
- .padding(20)
- .push(content)
+ .center_y()
.into()
}
}
diff --git a/native/src/layout/node.rs b/native/src/layout/node.rs
index 9d8ad57d..64ebf2d0 100644
--- a/native/src/layout/node.rs
+++ b/native/src/layout/node.rs
@@ -46,7 +46,9 @@ impl Node {
Align::Center => {
self.bounds.x += (space.width - self.bounds.width) / 2.0;
}
- Align::End => {}
+ Align::End => {
+ self.bounds.x += space.width - self.bounds.width;
+ }
}
match vertical_alignment {
@@ -54,7 +56,9 @@ impl Node {
Align::Center => {
self.bounds.y += (space.height - self.bounds.height) / 2.0;
}
- Align::End => {}
+ Align::End => {
+ self.bounds.y += space.height - self.bounds.height;
+ }
}
}
}
diff --git a/native/src/widget/container.rs b/native/src/widget/container.rs
index bb78a68c..c616db2a 100644
--- a/native/src/widget/container.rs
+++ b/native/src/widget/container.rs
@@ -1,8 +1,6 @@
use std::hash::Hash;
-use crate::{
- layout, Element, Event, Hasher, Layout, Length, Point, Size, Widget,
-};
+use crate::{layout, Element, Event, Hasher, Layout, Length, Point, Widget};
/// A container that distributes its contents vertically.
pub type Container<'a, Message, Renderer> =
@@ -73,7 +71,6 @@ where
self.height.hash(state);
self.max_width.hash(state);
self.max_height.hash(state);
- self.padding.hash(state);
self.content.hash_layout(state);
}
diff --git a/web/src/lib.rs b/web/src/lib.rs
index 559a5af0..6252f2be 100644
--- a/web/src/lib.rs
+++ b/web/src/lib.rs
@@ -7,7 +7,7 @@ pub mod widget;
pub use bus::Bus;
pub use element::Element;
-pub use iced_core::{Align, Background, Color, Justify, Length};
+pub use iced_core::{Align, Background, Color, Length};
pub use widget::*;
pub trait Application {