summaryrefslogtreecommitdiffstats
path: root/examples/clock
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón <hector@hecrj.dev>2024-07-12 21:40:46 +0200
committerLibravatar GitHub <noreply@github.com>2024-07-12 21:40:46 +0200
commit8cadd3b99485c344feb18b774c8e6fd6c1ea9dd7 (patch)
tree826fa9e0acdf3a4e003f882c94ff24a4ac9f50e4 /examples/clock
parentbe06060117da061ad8cad94ab0830c06def6b147 (diff)
parent3f480d3d18c41188bf40ead0a3dc4497316f11ae (diff)
downloadiced-8cadd3b99485c344feb18b774c8e6fd6c1ea9dd7.tar.gz
iced-8cadd3b99485c344feb18b774c8e6fd6c1ea9dd7.tar.bz2
iced-8cadd3b99485c344feb18b774c8e6fd6c1ea9dd7.zip
Merge pull request #2504 from iced-rs/view-ergonomics
Improved `view` ergonomics
Diffstat (limited to 'examples/clock')
-rw-r--r--examples/clock/src/main.rs14
1 files changed, 4 insertions, 10 deletions
diff --git a/examples/clock/src/main.rs b/examples/clock/src/main.rs
index 4584a0c7..ef3064c7 100644
--- a/examples/clock/src/main.rs
+++ b/examples/clock/src/main.rs
@@ -4,7 +4,7 @@ use iced::time;
use iced::widget::canvas::{stroke, Cache, Geometry, LineCap, Path, Stroke};
use iced::widget::{canvas, container};
use iced::{
- Degrees, Element, Font, Length, Point, Rectangle, Renderer, Subscription,
+ Degrees, Element, Fill, Font, Point, Rectangle, Renderer, Subscription,
Theme, Vector,
};
@@ -43,15 +43,9 @@ impl Clock {
}
fn view(&self) -> Element<Message> {
- let canvas = canvas(self as &Self)
- .width(Length::Fill)
- .height(Length::Fill);
-
- container(canvas)
- .width(Length::Fill)
- .height(Length::Fill)
- .padding(20)
- .into()
+ let canvas = canvas(self as &Self).width(Fill).height(Fill);
+
+ container(canvas).padding(20).into()
}
fn subscription(&self) -> Subscription<Message> {