diff options
Diffstat (limited to 'examples/toast')
| -rw-r--r-- | examples/toast/Cargo.toml | 3 | ||||
| -rw-r--r-- | examples/toast/src/main.rs | 26 | 
2 files changed, 17 insertions, 12 deletions
diff --git a/examples/toast/Cargo.toml b/examples/toast/Cargo.toml index f1f986aa..f703572c 100644 --- a/examples/toast/Cargo.toml +++ b/examples/toast/Cargo.toml @@ -6,5 +6,4 @@ edition = "2021"  publish = false  [dependencies] -iced = { path = "../..", features = [] } -iced_native = { path = "../../native" } +iced = { path = "../..", features = ["advanced"] } diff --git a/examples/toast/src/main.rs b/examples/toast/src/main.rs index b4b4e007..515218e7 100644 --- a/examples/toast/src/main.rs +++ b/examples/toast/src/main.rs @@ -178,17 +178,23 @@ mod toast {      use std::fmt;      use std::time::{Duration, Instant}; +    use iced::advanced; +    use iced::advanced::layout::{self, Layout}; +    use iced::advanced::overlay; +    use iced::advanced::renderer; +    use iced::advanced::widget::{self, Operation, Tree}; +    use iced::advanced::{Clipboard, Shell, Widget}; +    use iced::event::{self, Event}; +    use iced::mouse;      use iced::theme;      use iced::widget::{          button, column, container, horizontal_rule, horizontal_space, row, text,      }; +    use iced::window;      use iced::{          Alignment, Element, Length, Point, Rectangle, Renderer, Size, Theme,          Vector,      }; -    use iced_native::widget::{tree, Operation, Tree}; -    use iced_native::{event, layout, mouse, overlay, renderer, window}; -    use iced_native::{Clipboard, Event, Layout, Shell, Widget};      pub const DEFAULT_TIMEOUT: u64 = 5; @@ -220,7 +226,7 @@ mod toast {              };              container::Appearance { -                background: pair.color.into(), +                background: Some(pair.color.into()),                  text_color: pair.text.into(),                  ..Default::default()              } @@ -326,13 +332,13 @@ mod toast {              self.content.as_widget().layout(renderer, limits)          } -        fn tag(&self) -> tree::Tag { +        fn tag(&self) -> widget::tree::Tag {              struct Marker(Vec<Instant>); -            iced_native::widget::tree::Tag::of::<Marker>() +            widget::tree::Tag::of::<Marker>()          } -        fn state(&self) -> tree::State { -            iced_native::widget::tree::State::new(Vec::<Option<Instant>>::new()) +        fn state(&self) -> widget::tree::State { +            widget::tree::State::new(Vec::<Option<Instant>>::new())          }          fn children(&self) -> Vec<Tree> { @@ -586,7 +592,7 @@ mod toast {          fn draw(              &self,              renderer: &mut Renderer, -            theme: &<Renderer as iced_native::Renderer>::Theme, +            theme: &<Renderer as advanced::Renderer>::Theme,              style: &renderer::Style,              layout: Layout<'_>,              cursor_position: Point, @@ -615,7 +621,7 @@ mod toast {              &mut self,              layout: Layout<'_>,              renderer: &Renderer, -            operation: &mut dyn iced_native::widget::Operation<Message>, +            operation: &mut dyn widget::Operation<Message>,          ) {              operation.container(None, &mut |operation| {                  self.toasts  | 
