diff options
author | 2024-03-07 21:02:17 +0100 | |
---|---|---|
committer | 2024-03-07 21:02:17 +0100 | |
commit | 7ece5eea509f3595432babfc7729701f2e063b21 (patch) | |
tree | 42502a52270f24d1d323a268a36c689cd92aec82 /examples | |
parent | b8f05eb8dd0394e308385796c229cfc5bc4f3a73 (diff) | |
download | iced-7ece5eea509f3595432babfc7729701f2e063b21.tar.gz iced-7ece5eea509f3595432babfc7729701f2e063b21.tar.bz2 iced-7ece5eea509f3595432babfc7729701f2e063b21.zip |
Implement additional helpers for `Border` and `container::Appearance`
Diffstat (limited to 'examples')
-rw-r--r-- | examples/custom_widget/src/main.rs | 2 | ||||
-rw-r--r-- | examples/gradient/src/main.rs | 19 |
2 files changed, 6 insertions, 15 deletions
diff --git a/examples/custom_widget/src/main.rs b/examples/custom_widget/src/main.rs index 25c0bb39..305ef7dd 100644 --- a/examples/custom_widget/src/main.rs +++ b/examples/custom_widget/src/main.rs @@ -62,7 +62,7 @@ mod circle { renderer.fill_quad( renderer::Quad { bounds: layout.bounds(), - border: Border::with_radius(self.radius), + border: Border::rounded(self.radius), ..renderer::Quad::default() }, Color::BLACK, diff --git a/examples/gradient/src/main.rs b/examples/gradient/src/main.rs index 6d3ff125..4a8b2fa5 100644 --- a/examples/gradient/src/main.rs +++ b/examples/gradient/src/main.rs @@ -4,8 +4,7 @@ use iced::widget::{ }; use iced::{gradient, window}; use iced::{ - Alignment, Background, Color, Element, Length, Radians, Sandbox, Settings, - Theme, + Alignment, Color, Element, Length, Radians, Sandbox, Settings, Theme, }; pub fn main() -> iced::Result { @@ -71,20 +70,12 @@ impl Sandbox for Gradient { transparent, } = *self; - let appearance = { - let gradient = gradient::Linear::new(angle) - .add_stop(0.0, start) - .add_stop(1.0, end) - .into(); - - container::Appearance { - background: Some(Background::Gradient(gradient)), - ..Default::default() - } - }; + let gradient = gradient::Linear::new(angle) + .add_stop(0.0, start) + .add_stop(1.0, end); let gradient_box = themer( - appearance, + gradient, container(horizontal_space()) .width(Length::Fill) .height(Length::Fill), |