summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2023-02-04 12:24:13 +0100
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2023-02-17 15:40:17 +0100
commit7b8b01f560569ae18d9337a31ba94f6c1c2ba0dd (patch)
treeac9aac5eb82f175990da17813985d2f864897080 /examples
parentf75e0202575ca6e3ebf7d817eecbf51e198506fd (diff)
downloadiced-7b8b01f560569ae18d9337a31ba94f6c1c2ba0dd.tar.gz
iced-7b8b01f560569ae18d9337a31ba94f6c1c2ba0dd.tar.bz2
iced-7b8b01f560569ae18d9337a31ba94f6c1c2ba0dd.zip
Use `f32` in `Length::Units` and rename it to `Fixed`
Diffstat (limited to '')
-rw-r--r--examples/color_palette/src/main.rs4
-rw-r--r--examples/component/src/main.rs2
-rw-r--r--examples/events/src/main.rs2
-rw-r--r--examples/integration_opengl/src/controls.rs2
-rw-r--r--examples/integration_wgpu/src/controls.rs2
-rw-r--r--examples/modal/src/main.rs2
-rw-r--r--examples/pick_list/src/main.rs4
-rw-r--r--examples/qr_code/src/main.rs2
-rw-r--r--examples/scrollable/src/main.rs22
-rw-r--r--examples/slider/src/main.rs4
-rw-r--r--examples/stopwatch/src/main.rs2
-rw-r--r--examples/styling/src/main.rs12
-rw-r--r--examples/todos/src/main.rs4
-rw-r--r--examples/tour/src/main.rs8
14 files changed, 34 insertions, 38 deletions
diff --git a/examples/color_palette/src/main.rs b/examples/color_palette/src/main.rs
index 42149965..a2df36c2 100644
--- a/examples/color_palette/src/main.rs
+++ b/examples/color_palette/src/main.rs
@@ -301,11 +301,11 @@ impl<C: ColorSpace + Copy> ColorPicker<C> {
}
row![
- text(C::LABEL).width(Length::Units(50)),
+ text(C::LABEL).width(50),
slider(cr1, c1, move |v| C::new(v, c2, c3)),
slider(cr2, c2, move |v| C::new(c1, v, c3)),
slider(cr3, c3, move |v| C::new(c1, c2, v)),
- text(color.to_string()).width(Length::Units(185)).size(14),
+ text(color.to_string()).width(185).size(14),
]
.spacing(10)
.align_items(Alignment::Center)
diff --git a/examples/component/src/main.rs b/examples/component/src/main.rs
index 06b1e53a..c407bb06 100644
--- a/examples/component/src/main.rs
+++ b/examples/component/src/main.rs
@@ -127,7 +127,7 @@ mod numeric_input {
.horizontal_alignment(alignment::Horizontal::Center)
.vertical_alignment(alignment::Vertical::Center),
)
- .width(Length::Units(50))
+ .width(50)
.on_press(on_press)
};
diff --git a/examples/events/src/main.rs b/examples/events/src/main.rs
index 0e583479..1b97018e 100644
--- a/examples/events/src/main.rs
+++ b/examples/events/src/main.rs
@@ -93,7 +93,7 @@ impl Application for Events {
.width(Length::Fill)
.horizontal_alignment(alignment::Horizontal::Center),
)
- .width(Length::Units(100))
+ .width(100)
.padding(10)
.on_press(Message::Exit);
diff --git a/examples/integration_opengl/src/controls.rs b/examples/integration_opengl/src/controls.rs
index 22c41066..c3648f44 100644
--- a/examples/integration_opengl/src/controls.rs
+++ b/examples/integration_opengl/src/controls.rs
@@ -42,7 +42,7 @@ impl Program for Controls {
let background_color = self.background_color;
let sliders = Row::new()
- .width(Length::Units(500))
+ .width(500)
.spacing(20)
.push(
Slider::new(0.0..=1.0, background_color.r, move |r| {
diff --git a/examples/integration_wgpu/src/controls.rs b/examples/integration_wgpu/src/controls.rs
index 92300a45..533cb6e2 100644
--- a/examples/integration_wgpu/src/controls.rs
+++ b/examples/integration_wgpu/src/controls.rs
@@ -48,7 +48,7 @@ impl Program for Controls {
let text = &self.text;
let sliders = Row::new()
- .width(Length::Units(500))
+ .width(500)
.spacing(20)
.push(
slider(0.0..=1.0, background_color.r, move |r| {
diff --git a/examples/modal/src/main.rs b/examples/modal/src/main.rs
index 5afafd0d..54555684 100644
--- a/examples/modal/src/main.rs
+++ b/examples/modal/src/main.rs
@@ -156,7 +156,7 @@ impl Application for App {
]
.spacing(20),
)
- .width(Length::Units(300))
+ .width(300)
.padding(10)
.style(theme::Container::Box);
diff --git a/examples/pick_list/src/main.rs b/examples/pick_list/src/main.rs
index 9df1f5c7..62a4ef88 100644
--- a/examples/pick_list/src/main.rs
+++ b/examples/pick_list/src/main.rs
@@ -43,10 +43,10 @@ impl Sandbox for Example {
.placeholder("Choose a language...");
let content = column![
- vertical_space(Length::Units(600)),
+ vertical_space(600),
"Which is your favorite language?",
pick_list,
- vertical_space(Length::Units(600)),
+ vertical_space(600),
]
.width(Length::Fill)
.align_items(Alignment::Center)
diff --git a/examples/qr_code/src/main.rs b/examples/qr_code/src/main.rs
index c10c665b..d8041745 100644
--- a/examples/qr_code/src/main.rs
+++ b/examples/qr_code/src/main.rs
@@ -58,7 +58,7 @@ impl Sandbox for QRGenerator {
.padding(15);
let mut content = column![title, input]
- .width(Length::Units(700))
+ .width(700)
.spacing(20)
.align_items(Alignment::Center);
diff --git a/examples/scrollable/src/main.rs b/examples/scrollable/src/main.rs
index 128d98b2..7c858961 100644
--- a/examples/scrollable/src/main.rs
+++ b/examples/scrollable/src/main.rs
@@ -187,9 +187,9 @@ impl Application for ScrollableDemo {
column![
scroll_to_end_button(),
text("Beginning!"),
- vertical_space(Length::Units(1200)),
+ vertical_space(1200),
text("Middle!"),
- vertical_space(Length::Units(1200)),
+ vertical_space(1200),
text("End!"),
scroll_to_beginning_button(),
]
@@ -211,13 +211,13 @@ impl Application for ScrollableDemo {
row![
scroll_to_end_button(),
text("Beginning!"),
- horizontal_space(Length::Units(1200)),
+ horizontal_space(1200),
text("Middle!"),
- horizontal_space(Length::Units(1200)),
+ horizontal_space(1200),
text("End!"),
scroll_to_beginning_button(),
]
- .height(Length::Units(450))
+ .height(450)
.align_items(Alignment::Center)
.padding([0, 40, 0, 40])
.spacing(40),
@@ -237,26 +237,26 @@ impl Application for ScrollableDemo {
row![
column![
text("Let's do some scrolling!"),
- vertical_space(Length::Units(2400))
+ vertical_space(2400)
],
scroll_to_end_button(),
text("Horizontal - Beginning!"),
- horizontal_space(Length::Units(1200)),
+ horizontal_space(1200),
//vertical content
column![
text("Horizontal - Middle!"),
scroll_to_end_button(),
text("Vertical - Beginning!"),
- vertical_space(Length::Units(1200)),
+ vertical_space(1200),
text("Vertical - Middle!"),
- vertical_space(Length::Units(1200)),
+ vertical_space(1200),
text("Vertical - End!"),
scroll_to_beginning_button(),
- vertical_space(Length::Units(40)),
+ vertical_space(40),
]
.align_items(Alignment::Fill)
.spacing(40),
- horizontal_space(Length::Units(1200)),
+ horizontal_space(1200),
text("Horizontal - End!"),
scroll_to_beginning_button(),
]
diff --git a/examples/slider/src/main.rs b/examples/slider/src/main.rs
index 6286d625..e83804c2 100644
--- a/examples/slider/src/main.rs
+++ b/examples/slider/src/main.rs
@@ -38,11 +38,11 @@ impl Sandbox for Slider {
let h_slider =
container(slider(0..=100, value, Message::SliderChanged))
- .width(Length::Units(250));
+ .width(250);
let v_slider =
container(vertical_slider(0..=100, value, Message::SliderChanged))
- .height(Length::Units(200));
+ .height(200);
let text = text(format!("{value}"));
diff --git a/examples/stopwatch/src/main.rs b/examples/stopwatch/src/main.rs
index b8cee807..9581a3ce 100644
--- a/examples/stopwatch/src/main.rs
+++ b/examples/stopwatch/src/main.rs
@@ -105,7 +105,7 @@ impl Application for Stopwatch {
text(label).horizontal_alignment(alignment::Horizontal::Center),
)
.padding(10)
- .width(Length::Units(80))
+ .width(80)
};
let toggle_button = {
diff --git a/examples/styling/src/main.rs b/examples/styling/src/main.rs
index 49bedce7..448c9792 100644
--- a/examples/styling/src/main.rs
+++ b/examples/styling/src/main.rs
@@ -108,14 +108,10 @@ impl Sandbox for Styling {
let progress_bar = progress_bar(0.0..=100.0, self.slider_value);
let scrollable = scrollable(
- column![
- "Scroll me!",
- vertical_space(Length::Units(800)),
- "You did it!"
- ]
- .width(Length::Fill),
+ column!["Scroll me!", vertical_space(800), "You did it!"]
+ .width(Length::Fill),
)
- .height(Length::Units(100));
+ .height(100);
let checkbox = checkbox(
"Check me!",
@@ -143,7 +139,7 @@ impl Sandbox for Styling {
column![checkbox, toggler].spacing(20)
]
.spacing(10)
- .height(Length::Units(100))
+ .height(100)
.align_items(Alignment::Center),
]
.spacing(20)
diff --git a/examples/todos/src/main.rs b/examples/todos/src/main.rs
index 04411ed7..6408f09c 100644
--- a/examples/todos/src/main.rs
+++ b/examples/todos/src/main.rs
@@ -460,7 +460,7 @@ fn empty_message(message: &str) -> Element<'_, Message> {
.style(Color::from([0.7, 0.7, 0.7])),
)
.width(Length::Fill)
- .height(Length::Units(200))
+ .height(200)
.center_y()
.into()
}
@@ -474,7 +474,7 @@ const ICONS: Font = Font::External {
fn icon(unicode: char) -> Text<'static> {
text(unicode.to_string())
.font(ICONS)
- .width(Length::Units(20))
+ .width(20)
.horizontal_alignment(alignment::Horizontal::Center)
.size(20)
}
diff --git a/examples/tour/src/main.rs b/examples/tour/src/main.rs
index 5ee65562..de063d00 100644
--- a/examples/tour/src/main.rs
+++ b/examples/tour/src/main.rs
@@ -513,14 +513,14 @@ impl<'a> Step {
text("Tip: You can use the scrollbar to scroll down faster!")
.size(16),
)
- .push(vertical_space(Length::Units(4096)))
+ .push(vertical_space(4096))
.push(
text("You are halfway there!")
.width(Length::Fill)
.size(30)
.horizontal_alignment(alignment::Horizontal::Center),
)
- .push(vertical_space(Length::Units(4096)))
+ .push(vertical_space(4096))
.push(ferris(300))
.push(
text("You made it!")
@@ -605,7 +605,7 @@ fn ferris<'a>(width: u16) -> Container<'a, StepMessage> {
} else {
image(format!("{}/images/ferris.png", env!("CARGO_MANIFEST_DIR")))
}
- .width(Length::Units(width)),
+ .width(width),
)
.width(Length::Fill)
.center_x()
@@ -616,7 +616,7 @@ fn button<'a, Message: Clone>(label: &str) -> Button<'a, Message> {
text(label).horizontal_alignment(alignment::Horizontal::Center),
)
.padding(12)
- .width(Length::Units(100))
+ .width(100)
}
fn color_slider<'a>(