Implement cursor movement in TextInput

This commit is contained in:
Héctor Ramón Jiménez 2019-10-31 03:50:40 +01:00
parent 374b54c3ec
commit 51a0e99097
4 changed files with 176 additions and 50 deletions

View file

@ -15,26 +15,6 @@ struct Todos {
tasks: Vec<Task>,
}
#[derive(Debug)]
struct Task {
description: String,
completed: bool,
}
impl Task {
fn new(description: String) -> Self {
Task {
description,
completed: false,
}
}
fn view(&mut self) -> Element<bool> {
Checkbox::new(self.completed, &self.description, |checked| checked)
.into()
}
}
#[derive(Debug, Clone)]
pub enum Message {
InputChanged(String),
@ -107,6 +87,26 @@ impl Application for Todos {
}
}
#[derive(Debug)]
struct Task {
description: String,
completed: bool,
}
impl Task {
fn new(description: String) -> Self {
Task {
description,
completed: false,
}
}
fn view(&mut self) -> Element<bool> {
Checkbox::new(self.completed, &self.description, |checked| checked)
.into()
}
}
// Colors
const GRAY: Color = Color {
r: 0.5,