summaryrefslogtreecommitdiffstats
path: root/examples/gradient
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-03-07 21:02:17 +0100
committerLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-03-07 21:02:17 +0100
commit7ece5eea509f3595432babfc7729701f2e063b21 (patch)
tree42502a52270f24d1d323a268a36c689cd92aec82 /examples/gradient
parentb8f05eb8dd0394e308385796c229cfc5bc4f3a73 (diff)
downloadiced-7ece5eea509f3595432babfc7729701f2e063b21.tar.gz
iced-7ece5eea509f3595432babfc7729701f2e063b21.tar.bz2
iced-7ece5eea509f3595432babfc7729701f2e063b21.zip
Implement additional helpers for `Border` and `container::Appearance`
Diffstat (limited to 'examples/gradient')
-rw-r--r--examples/gradient/src/main.rs19
1 files changed, 5 insertions, 14 deletions
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),