From ae123d8f14c14a2c393bcf00dc364844a32cc0c8 Mon Sep 17 00:00:00 2001 From: Rowun Giles <1868220+rowungiles@users.noreply.github.com> Date: Mon, 16 Mar 2020 10:08:37 +0000 Subject: Instantiate Column and Row with children --- web/src/widget/column.rs | 16 ++++++++++++++++ web/src/widget/row.rs | 16 ++++++++++++++++ 2 files changed, 32 insertions(+) (limited to 'web') diff --git a/web/src/widget/column.rs b/web/src/widget/column.rs index 6454ffba..f1d9f9a2 100644 --- a/web/src/widget/column.rs +++ b/web/src/widget/column.rs @@ -37,6 +37,22 @@ impl<'a, Message> Column<'a, Message> { } } + /// Creates a [`Column`] with children. + /// + /// [`Column`]: struct.Column.html + pub fn new_with_children(children: Vec>) -> Self { + Column { + spacing: 0, + padding: 0, + width: Length::Fill, + height: Length::Shrink, + max_width: u32::MAX, + max_height: u32::MAX, + align_items: Align::Start, + children, + } + } + /// Sets the vertical spacing _between_ elements. /// /// Custom margins per element do not exist in Iced. You should use this diff --git a/web/src/widget/row.rs b/web/src/widget/row.rs index 02035113..55077d52 100644 --- a/web/src/widget/row.rs +++ b/web/src/widget/row.rs @@ -37,6 +37,22 @@ impl<'a, Message> Row<'a, Message> { } } + /// Creates a [`Row`] with children. + /// + /// [`Row`]: struct.Row.html + pub fn new_with_children(children: Vec>) -> Self { + Row { + spacing: 0, + padding: 0, + width: Length::Fill, + height: Length::Shrink, + max_width: u32::MAX, + max_height: u32::MAX, + align_items: Align::Start, + children, + } + } + /// Sets the horizontal spacing _between_ elements. /// /// Custom margins per element do not exist in Iced. You should use this -- cgit From 99b5212550f225a21e1d1144c6fb9ebb8f4e6ed2 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Tue, 17 Mar 2020 00:53:51 +0100 Subject: Implement `Column` and `Row` changes in `iced_web` --- web/src/widget/column.rs | 15 +++------------ web/src/widget/row.rs | 15 +++------------ 2 files changed, 6 insertions(+), 24 deletions(-) (limited to 'web') diff --git a/web/src/widget/column.rs b/web/src/widget/column.rs index f1d9f9a2..25b88b0e 100644 --- a/web/src/widget/column.rs +++ b/web/src/widget/column.rs @@ -25,22 +25,13 @@ impl<'a, Message> Column<'a, Message> { /// /// [`Column`]: struct.Column.html pub fn new() -> Self { - Column { - spacing: 0, - padding: 0, - width: Length::Fill, - height: Length::Shrink, - max_width: u32::MAX, - max_height: u32::MAX, - align_items: Align::Start, - children: Vec::new(), - } + Self::with_children(Vec::new()) } - /// Creates a [`Column`] with children. + /// Creates a [`Column`] with the given elements. /// /// [`Column`]: struct.Column.html - pub fn new_with_children(children: Vec>) -> Self { + pub fn with_children(children: Vec>) -> Self { Column { spacing: 0, padding: 0, diff --git a/web/src/widget/row.rs b/web/src/widget/row.rs index 55077d52..cfa10fdf 100644 --- a/web/src/widget/row.rs +++ b/web/src/widget/row.rs @@ -25,22 +25,13 @@ impl<'a, Message> Row<'a, Message> { /// /// [`Row`]: struct.Row.html pub fn new() -> Self { - Row { - spacing: 0, - padding: 0, - width: Length::Fill, - height: Length::Shrink, - max_width: u32::MAX, - max_height: u32::MAX, - align_items: Align::Start, - children: Vec::new(), - } + Self::with_children(Vec::new()) } - /// Creates a [`Row`] with children. + /// Creates a [`Row`] with the given elements. /// /// [`Row`]: struct.Row.html - pub fn new_with_children(children: Vec>) -> Self { + pub fn with_children(children: Vec>) -> Self { Row { spacing: 0, padding: 0, -- cgit From 05beb878527b4d4e3141ca5ba09337d6ada858be Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Tue, 17 Mar 2020 07:28:28 +0100 Subject: Move common keyboard types to `iced_core` Also expose them in `iced` through `iced_native` and `iced_web`. --- web/src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'web') diff --git a/web/src/lib.rs b/web/src/lib.rs index 258ad9e7..1de00545 100644 --- a/web/src/lib.rs +++ b/web/src/lib.rs @@ -73,8 +73,8 @@ pub use dodrio; pub use element::Element; pub use hasher::Hasher; pub use iced_core::{ - Align, Background, Color, Font, HorizontalAlignment, Length, Point, Size, - Vector, VerticalAlignment, + keyboard, Align, Background, Color, Font, HorizontalAlignment, Length, + Point, Size, Vector, VerticalAlignment, }; pub use iced_futures::{executor, futures, Command}; pub use subscription::Subscription; -- cgit From 93f5640a2dc06d8f1bf2b0d033d45c62f8985380 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Fri, 20 Mar 2020 05:21:46 +0100 Subject: Fix `wasm-bindgen` command in `README` of `iced_web` --- web/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'web') diff --git a/web/README.md b/web/README.md index aceb4a97..83d1500f 100644 --- a/web/README.md +++ b/web/README.md @@ -36,7 +36,7 @@ For instance, let's say we want to build the [`tour` example]: ``` cd examples cargo build --package tour --target wasm32-unknown-unknown -wasm-bindgen ../target/wasm32-unknown-unknown/debug/examples/tour.wasm --out-dir tour --web +wasm-bindgen ../target/wasm32-unknown-unknown/debug/tour.wasm --out-dir tour --web ``` *__Note:__ Keep in mind that Iced is still in early exploration stages and most of the work needs to happen on the native side of the ecosystem. At this stage, it is important to be able to batch work without having to constantly jump back and forth. Because of this, there is currently no requirement for the `master` branch to contain a cross-platform API at all times. If you hit an issue when building an example and want to help, it may be a good way to [start contributing]!* -- cgit