Support async actions in iced_winit

This commit is contained in:
Héctor Ramón Jiménez 2019-11-17 07:09:46 +01:00
parent e640b87590
commit 02c20e6202
7 changed files with 110 additions and 47 deletions

View file

@ -1,11 +1,11 @@
use iced::{
button, scrollable, text::HorizontalAlignment, text_input, Align,
Application, Background, Button, Checkbox, Color, Column, Container,
Element, Font, Length, Row, Scrollable, Text, TextInput,
Application, Background, Button, Checkbox, Color, Column, Command,
Container, Element, Font, Length, Row, Scrollable, Text, TextInput,
};
pub fn main() {
Todos::default().run()
Todos::run()
}
#[derive(Debug, Default)]
@ -29,11 +29,15 @@ pub enum Message {
impl Application for Todos {
type Message = Message;
fn new() -> (Todos, Command<Message>) {
(Todos::default(), Command::none())
}
fn title(&self) -> String {
String::from("Todos - Iced")
}
fn update(&mut self, message: Message) {
fn update(&mut self, message: Message) -> Command<Message> {
match message {
Message::InputChanged(value) => {
self.input_value = value;
@ -58,6 +62,8 @@ impl Application for Todos {
}
dbg!(self);
Command::none()
}
fn view(&mut self) -> Element<Message> {