Draft iced_virtual subcrate

The idea here is to expose a set of "virtual widgets" that can be used with a
`Virtual` widget and its `virtual::State`.

A virtual widget is a widget that does not contain any state, but instead is a
"virtual" representation of the "real" widget. The real widgets are stored in
the `virtual::State`.

Every time a new virtual widget tree is created during `view`, it is compared to
the previous one and "real" widgets are added / removed to the `virtual::State`.

Effectively, this removes the need to keep track of local widget state in the
application state and allows `view` to take an immutable reference to `self`.

To summarize, using this crate should allow users to remove `State` structs
in their application state.

Eventually, the strategy used here may be adopted generally and, as a result,
all of the widgets in `iced_native` would be replaced!
This commit is contained in:
Héctor Ramón Jiménez 2022-02-09 19:42:15 +07:00
parent adce9e0421
commit 8f0839e786
No known key found for this signature in database
GPG key ID: 140CC052C94F138E
6 changed files with 223 additions and 0 deletions

8
virtual/Cargo.toml Normal file
View file

@ -0,0 +1,8 @@
[package]
name = "iced_virtual"
version = "0.1.0"
edition = "2021"
[dependencies]
iced_native = { version = "0.4", path = "../native" }
iced_style = { version = "0.3", path = "../style" }