-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace stateful widgets with the new iced_pure
API
#1393
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
hecrj
added
improvement
An internal improvement
feature
New feature or request
developer experience
widget
shell
labels
Jul 27, 2022
... as well as a `count_focusable` composable helper!
Merged
tarkah
reviewed
Aug 5, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
developer experience
feature
New feature or request
improvement
An internal improvement
shell
widget
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR replaces the current stateful widgets with the new widget API introduced by
iced_pure
in #1284.The changes here remove a lot of code and prepare the codebase for the soon-to-land widget operations described in iced-rs/rfcs#7.
Some of the most relevant changes are:
iced_pure
code has been removed and the crate is deprecated.The
pure
feature has been removed.Widget types are no longer re-exported in the root
iced
crate. Instead, they have to be properly imported with the full path (eg.use iced::widget::Text
).The widget function helpers in
iced_pure
have been moved toiced::widget
.A couple of new macros have been added in
iced::widget
:column
androw
. They are analogous tovec!
. Therefore, the old approachcan now be written as follows:
The
row
andcolumn
function helpers are also available, and they are equivalent toRow::with_children
andColumn::with_children
. These are useful when you have an iterator or aVec
of elements!Text::new
now can take anyToString
instead ofInto<String>
.All of the internal
State
types are no longer exported iniced
.Thanks to all of these changes, all of the examples are now much simpler and less verbose! For instance, here is the new
counter
example:Once the widget operations land soon, this API will satisfy all of the use cases supported by the stateful one (and more!), while being way less verbose and cumbersome.