Merge pull request #246 from hecrj/feature/application-flags
Application flags
This commit is contained in:
commit
e79e832092
14 changed files with 119 additions and 63 deletions
|
|
@ -23,8 +23,9 @@ enum Message {
|
|||
impl Application for Clock {
|
||||
type Executor = executor::Default;
|
||||
type Message = Message;
|
||||
type Flags = ();
|
||||
|
||||
fn new() -> (Self, Command<Message>) {
|
||||
fn new(_flags: ()) -> (Self, Command<Message>) {
|
||||
(
|
||||
Clock {
|
||||
now: chrono::Local::now().into(),
|
||||
|
|
|
|||
|
|
@ -26,8 +26,9 @@ pub enum Message {
|
|||
impl Application for Example {
|
||||
type Executor = executor::Default;
|
||||
type Message = Message;
|
||||
type Flags = ();
|
||||
|
||||
fn new() -> (Example, Command<Message>) {
|
||||
fn new(_flags: ()) -> (Example, Command<Message>) {
|
||||
(
|
||||
Example::Idle {
|
||||
button: button::State::new(),
|
||||
|
|
|
|||
|
|
@ -22,8 +22,9 @@ enum Message {
|
|||
impl Application for Events {
|
||||
type Executor = executor::Default;
|
||||
type Message = Message;
|
||||
type Flags = ();
|
||||
|
||||
fn new() -> (Events, Command<Message>) {
|
||||
fn new(_flags: ()) -> (Events, Command<Message>) {
|
||||
(Events::default(), Command::none())
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -29,8 +29,9 @@ enum Message {
|
|||
impl Application for Pokedex {
|
||||
type Executor = iced::executor::Default;
|
||||
type Message = Message;
|
||||
type Flags = ();
|
||||
|
||||
fn new() -> (Pokedex, Command<Message>) {
|
||||
fn new(_flags: ()) -> (Pokedex, Command<Message>) {
|
||||
(
|
||||
Pokedex::Loading,
|
||||
Command::perform(Pokemon::search(), Message::PokemonFound),
|
||||
|
|
|
|||
|
|
@ -7,8 +7,8 @@
|
|||
//!
|
||||
//! [1]: https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API/Tutorial/Basic_animations#An_animated_solar_system
|
||||
use iced::{
|
||||
canvas, executor, Application, Canvas, Color, Command, Container, Element,
|
||||
Length, Point, Settings, Size, Subscription, Vector,
|
||||
canvas, executor, window, Application, Canvas, Color, Command, Container,
|
||||
Element, Length, Point, Settings, Size, Subscription, Vector,
|
||||
};
|
||||
|
||||
use std::time::Instant;
|
||||
|
|
@ -33,8 +33,9 @@ enum Message {
|
|||
impl Application for SolarSystem {
|
||||
type Executor = executor::Default;
|
||||
type Message = Message;
|
||||
type Flags = ();
|
||||
|
||||
fn new() -> (Self, Command<Message>) {
|
||||
fn new(_flags: ()) -> (Self, Command<Message>) {
|
||||
(
|
||||
SolarSystem {
|
||||
state: State::new(),
|
||||
|
|
@ -95,7 +96,7 @@ impl State {
|
|||
|
||||
pub fn new() -> State {
|
||||
let now = Instant::now();
|
||||
let (width, height) = Settings::default().window.size;
|
||||
let (width, height) = window::Settings::default().size;
|
||||
|
||||
State {
|
||||
start: now,
|
||||
|
|
|
|||
|
|
@ -30,8 +30,9 @@ enum Message {
|
|||
impl Application for Stopwatch {
|
||||
type Executor = iced_futures::executor::AsyncStd;
|
||||
type Message = Message;
|
||||
type Flags = ();
|
||||
|
||||
fn new() -> (Stopwatch, Command<Message>) {
|
||||
fn new(_flags: ()) -> (Stopwatch, Command<Message>) {
|
||||
(
|
||||
Stopwatch {
|
||||
duration: Duration::default(),
|
||||
|
|
|
|||
|
|
@ -40,8 +40,9 @@ enum Message {
|
|||
impl Application for Todos {
|
||||
type Executor = iced::executor::Default;
|
||||
type Message = Message;
|
||||
type Flags = ();
|
||||
|
||||
fn new() -> (Todos, Command<Message>) {
|
||||
fn new(_flags: ()) -> (Todos, Command<Message>) {
|
||||
(
|
||||
Todos::Loading,
|
||||
Command::perform(SavedState::load(), Message::Loaded),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue