summaryrefslogtreecommitdiffstats
path: root/native/src
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2020-03-17 03:23:10 +0100
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2020-03-17 03:23:10 +0100
commitc7583f12270082dc2f4d766aea50be7bd49b6c50 (patch)
treebf4529c0deec92a72f72a157b35299b6d1e7d4de /native/src
parenta373682fa4e8d57d66707faef1fb6b373f4297eb (diff)
parent9da6ce474c2cd178ca5365d46760ba0882ce7121 (diff)
downloadiced-c7583f12270082dc2f4d766aea50be7bd49b6c50.tar.gz
iced-c7583f12270082dc2f4d766aea50be7bd49b6c50.tar.bz2
iced-c7583f12270082dc2f4d766aea50be7bd49b6c50.zip
Merge branch 'master' into feature/panes-widget
Diffstat (limited to 'native/src')
-rw-r--r--native/src/widget/column.rs11
-rw-r--r--native/src/widget/row.rs11
-rw-r--r--native/src/widget/scrollable.rs4
3 files changed, 22 insertions, 4 deletions
diff --git a/native/src/widget/column.rs b/native/src/widget/column.rs
index 104790d4..a7a6f242 100644
--- a/native/src/widget/column.rs
+++ b/native/src/widget/column.rs
@@ -30,6 +30,15 @@ impl<'a, Message, Renderer> Column<'a, Message, Renderer> {
///
/// [`Column`]: struct.Column.html
pub fn new() -> Self {
+ Self::with_children(Vec::new())
+ }
+
+ /// Creates a [`Column`] with the given elements.
+ ///
+ /// [`Column`]: struct.Column.html
+ pub fn with_children(
+ children: Vec<Element<'a, Message, Renderer>>,
+ ) -> Self {
Column {
spacing: 0,
padding: 0,
@@ -38,7 +47,7 @@ impl<'a, Message, Renderer> Column<'a, Message, Renderer> {
max_width: u32::MAX,
max_height: u32::MAX,
align_items: Align::Start,
- children: Vec::new(),
+ children,
}
}
diff --git a/native/src/widget/row.rs b/native/src/widget/row.rs
index 775b953e..c8812ea2 100644
--- a/native/src/widget/row.rs
+++ b/native/src/widget/row.rs
@@ -30,6 +30,15 @@ impl<'a, Message, Renderer> Row<'a, Message, Renderer> {
///
/// [`Row`]: struct.Row.html
pub fn new() -> Self {
+ Self::with_children(Vec::new())
+ }
+
+ /// Creates a [`Row`] with the given elements.
+ ///
+ /// [`Row`]: struct.Row.html
+ pub fn with_children(
+ children: Vec<Element<'a, Message, Renderer>>,
+ ) -> Self {
Row {
spacing: 0,
padding: 0,
@@ -38,7 +47,7 @@ impl<'a, Message, Renderer> Row<'a, Message, Renderer> {
max_width: u32::MAX,
max_height: u32::MAX,
align_items: Align::Start,
- children: Vec::new(),
+ children,
}
}
diff --git a/native/src/widget/scrollable.rs b/native/src/widget/scrollable.rs
index e83f25af..ec9746d4 100644
--- a/native/src/widget/scrollable.rs
+++ b/native/src/widget/scrollable.rs
@@ -118,7 +118,7 @@ where
Renderer: 'static + self::Renderer + column::Renderer,
{
fn width(&self) -> Length {
- Length::Fill
+ Widget::<Message, Renderer>::width(&self.content)
}
fn height(&self) -> Length {
@@ -132,7 +132,7 @@ where
) -> layout::Node {
let limits = limits
.max_height(self.max_height)
- .width(Length::Fill)
+ .width(Widget::<Message, Renderer>::width(&self.content))
.height(self.height);
let child_limits = layout::Limits::new(