Use Sandbox
in tour
example
This commit is contained in:
parent
7f9813d4b3
commit
6de0a2c371
@ -1,8 +1,7 @@
|
|||||||
use iced::{
|
use iced::{
|
||||||
button, executor, scrollable, slider, text_input, Application, Button,
|
button, scrollable, slider, text_input, Button, Checkbox, Color, Column,
|
||||||
Checkbox, Color, Column, Command, Container, Element, HorizontalAlignment,
|
Container, Element, HorizontalAlignment, Image, Length, Radio, Row,
|
||||||
Image, Length, Radio, Row, Scrollable, Settings, Slider, Space, Text,
|
Sandbox, Scrollable, Settings, Slider, Space, Text, TextInput,
|
||||||
TextInput,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
pub fn main() {
|
pub fn main() {
|
||||||
@ -19,29 +18,24 @@ pub struct Tour {
|
|||||||
debug: bool,
|
debug: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Application for Tour {
|
impl Sandbox for Tour {
|
||||||
type Executor = executor::Null;
|
|
||||||
type Message = Message;
|
type Message = Message;
|
||||||
type Flags = ();
|
|
||||||
|
|
||||||
fn new(_flags: ()) -> (Tour, Command<Message>) {
|
fn new() -> Tour {
|
||||||
(
|
Tour {
|
||||||
Tour {
|
steps: Steps::new(),
|
||||||
steps: Steps::new(),
|
scroll: scrollable::State::new(),
|
||||||
scroll: scrollable::State::new(),
|
back_button: button::State::new(),
|
||||||
back_button: button::State::new(),
|
next_button: button::State::new(),
|
||||||
next_button: button::State::new(),
|
debug: false,
|
||||||
debug: false,
|
}
|
||||||
},
|
|
||||||
Command::none(),
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn title(&self) -> String {
|
fn title(&self) -> String {
|
||||||
format!("{} - Iced", self.steps.title())
|
format!("{} - Iced", self.steps.title())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn update(&mut self, event: Message) -> Command<Message> {
|
fn update(&mut self, event: Message) {
|
||||||
match event {
|
match event {
|
||||||
Message::BackPressed => {
|
Message::BackPressed => {
|
||||||
self.steps.go_back();
|
self.steps.go_back();
|
||||||
@ -53,8 +47,6 @@ impl Application for Tour {
|
|||||||
self.steps.update(step_msg, &mut self.debug);
|
self.steps.update(step_msg, &mut self.debug);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Command::none()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn view(&mut self) -> Element<Message> {
|
fn view(&mut self) -> Element<Message> {
|
||||||
|
Loading…
Reference in New Issue
Block a user