summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/solar_system/src/main.rs8
-rw-r--r--examples/toast/src/main.rs2
-rw-r--r--examples/tour/src/main.rs30
3 files changed, 21 insertions, 19 deletions
diff --git a/examples/solar_system/src/main.rs b/examples/solar_system/src/main.rs
index 42606e3f..d9e660d7 100644
--- a/examples/solar_system/src/main.rs
+++ b/examples/solar_system/src/main.rs
@@ -10,8 +10,9 @@ use iced::application;
use iced::executor;
use iced::theme::{self, Theme};
use iced::widget::canvas;
+use iced::widget::canvas::gradient;
use iced::widget::canvas::stroke::{self, Stroke};
-use iced::widget::canvas::{Cursor, Gradient, Path};
+use iced::widget::canvas::{Cursor, Path};
use iced::window;
use iced::{
Application, Color, Command, Element, Length, Point, Rectangle, Renderer,
@@ -209,13 +210,12 @@ impl<Message> canvas::Program<Message> for State {
let earth = Path::circle(Point::ORIGIN, Self::EARTH_RADIUS);
- let earth_fill = Gradient::linear(
+ let earth_fill = gradient::Linear::new(
Point::new(-Self::EARTH_RADIUS, 0.0),
Point::new(Self::EARTH_RADIUS, 0.0),
)
.add_stop(0.2, Color::from_rgb(0.15, 0.50, 1.0))
- .add_stop(0.8, Color::from_rgb(0.0, 0.20, 0.47))
- .build();
+ .add_stop(0.8, Color::from_rgb(0.0, 0.20, 0.47));
frame.fill(&earth, earth_fill);
diff --git a/examples/toast/src/main.rs b/examples/toast/src/main.rs
index 9d859258..515218e7 100644
--- a/examples/toast/src/main.rs
+++ b/examples/toast/src/main.rs
@@ -226,7 +226,7 @@ mod toast {
};
container::Appearance {
- background: pair.color.into(),
+ background: Some(pair.color.into()),
text_color: pair.text.into(),
..Default::default()
}
diff --git a/examples/tour/src/main.rs b/examples/tour/src/main.rs
index 630b6359..a40f0f33 100644
--- a/examples/tour/src/main.rs
+++ b/examples/tour/src/main.rs
@@ -1,3 +1,4 @@
+use iced::gradient;
use iced::theme;
use iced::theme::Palette;
use iced::widget::{
@@ -7,8 +8,7 @@ use iced::widget::{
use iced::widget::{Button, Column, Container, Slider};
use iced::{alignment, widget, Theme};
use iced::{
- Color, Degrees, Element, Font, Gradient, Length, Radians, Renderer,
- Sandbox, Settings,
+ Color, Degrees, Element, Font, Length, Radians, Renderer, Sandbox, Settings,
};
pub fn main() -> iced::Result {
@@ -734,23 +734,25 @@ impl widget::button::StyleSheet for CustomButtonStyle {
fn active(&self, _style: &Self::Style) -> widget::button::Appearance {
match self {
CustomButtonStyle::Primary => widget::button::Appearance {
- background: Gradient::linear(Degrees(270.0))
- .add_stop(0.0, Palette::LIGHT.primary)
- .add_stop(1.0, Color::from_rgb8(54, 80, 168))
- .build()
- .into(),
+ background: Some(
+ gradient::Linear::new(Degrees(270.0))
+ .add_stop(0.0, Palette::LIGHT.primary)
+ .add_stop(1.0, Color::from_rgb8(54, 80, 168))
+ .into(),
+ ),
text_color: Color::WHITE,
border_radius: 5.0,
..Default::default()
},
CustomButtonStyle::Secondary => widget::button::Appearance {
- background: Gradient::linear(Radians(
- 3.0 * std::f32::consts::PI / 2.0,
- ))
- .add_stop(0.0, Color::from_rgb8(194, 194, 194))
- .add_stop(1.0, Color::from_rgb8(126, 126, 126))
- .build()
- .into(),
+ background: Some(
+ gradient::Linear::new(Radians(
+ 3.0 * std::f32::consts::PI / 2.0,
+ ))
+ .add_stop(0.0, Color::from_rgb8(194, 194, 194))
+ .add_stop(1.0, Color::from_rgb8(126, 126, 126))
+ .into(),
+ ),
text_color: Color::WHITE,
border_radius: 5.0,
..Default::default()