Implement pure version of todos example 🎉
The `Widget` trait in `iced_pure` needed to change a bit to make the implementation of `Element::map` possible. Specifically, the `children` method has been split into `diff` and `children_state`.
This commit is contained in:
parent
e3108494e5
commit
bd22cc0bc0
18 changed files with 917 additions and 96 deletions
|
|
@ -146,8 +146,10 @@ where
|
|||
Box::new(text_input::State::new())
|
||||
}
|
||||
|
||||
fn children(&self) -> &[Element<Message, Renderer>] {
|
||||
&[]
|
||||
fn diff(&self, _tree: &mut Tree) {}
|
||||
|
||||
fn children_state(&self) -> Vec<Tree> {
|
||||
Vec::new()
|
||||
}
|
||||
|
||||
fn width(&self) -> Length {
|
||||
|
|
@ -237,3 +239,16 @@ where
|
|||
text_input::mouse_interaction(layout, cursor_position)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, Message, Renderer> From<TextInput<'a, Message, Renderer>>
|
||||
for Element<'a, Message, Renderer>
|
||||
where
|
||||
Message: 'a + Clone,
|
||||
Renderer: 'a + text::Renderer,
|
||||
{
|
||||
fn from(
|
||||
text_input: TextInput<'a, Message, Renderer>,
|
||||
) -> Element<'a, Message, Renderer> {
|
||||
Element::new(text_input)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue