-
Notifications
You must be signed in to change notification settings - Fork 307
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/feat/12562' into feat/12562
- Loading branch information
Showing
3 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Rust-GUI-via-Flutter Utilities | ||
|
||
If you want to use Flutter as GUI of Rust, | ||
please refer to the article in https://cjycode.com/posts/rust-ui-flutter/, | ||
which contains background, pros, cons, tutorial, examples, etc. | ||
|
||
Firstly, this is just one of the infinitely many approaches to let Flutter be the GUI of Rust, | ||
and you are free to choose whatever other approaches that suits your need. | ||
|
||
In that article, the `#[frb(ui_state)]` and `#[frb(ui_mutation)]` lightweight attributes are utilized. | ||
They are not stabilized, i.e. can have breaking changes without major version bumping. | ||
More details are as follows: | ||
|
||
* `#[frb(ui_state)]`: Annotate on your state struct. | ||
* `#[frb(ui_mutation)]`: Annotate on state methods that mutates the state. It can also be annotated on the `impl` block, | ||
which is equivalent to annotate on each method in that block. | ||
|
||
Then, whenever a method with `#[frb(ui_mutation)]` is called, | ||
the Flutter UI will know the state is changed and needs to automatically refresh the UI. |
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