Implement cursor movement in TextInput
This commit is contained in:
parent
374b54c3ec
commit
51a0e99097
4 changed files with 176 additions and 50 deletions
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue