Show HN: Rust GUI Library via Flutter
301 points| fzyzcjy | 1 year ago |cjycode.com
Then, as an example, I showed how to write Rust applications with GUI by utilizing Flutter. That is discussed in the link in details.
To play with it, please visit the GitHub repo, or refer to the end of the article for detailed folders and commands.
When I first released 1.0.0 years ago, it only contained few features compared to today. It is the result of the hard work of contributors and me, and many thanks to all the contributors!
tmpfs|1 year ago
Upgrading from v1 to v2 was not too difficult and v2 is a significant upgrade with lots of useful features, massively improved codegen experience and support for tokio async were the big gamechangers for me.
Writing all the app business logic in Rust and using Dart as the front-end works out really well. I know Flutter/Dart doesn't get much love here on HN but in my opinion I think it's much easier to reason about than a system like React which I think is the wrong level of abstraction compared to Flutter's render the entire widget tree approach.
Massive thanks to @fzyzcjy for all the work on FRB, great job!
[0]: https://saveoursecrets.com
bmitc|1 year ago
It also still has all the remnants of mobile and fingers and not desktop and mouse. Support for improving this is non-existent in my experience.
MrJohz|1 year ago
Could you expand on this a bit? My impression was that Flutter and React had relatively similar approaches to components, but I haven't had much experience with Flutter yet, so I'm interested to hear your experiences!
satvikpendem|1 year ago
fzyzcjy|1 year ago
nu11ptr|1 year ago
Yeah I really like Flutter/Dart. I had less an issue with React itself than I did the whole HTML/CSS/Javascript ecosystem and tooling. Flutter is a breath of fresh air in that it is a purpose built ecosystem for UIs. You load the SDK and are ready to go with features like hot reload out of the box. No need for gamut of tools and to figure out how they all work together. Also, no need for HTML + CSS! I think the only reason it isn't more popular is because we have such a huge # of frontend devs already trained on HTML/CSS/JS, as Flutter is a lot simpler out of the gate, and much easier for traditional GUI paradigm people IMO.
samstave|1 year ago
So is the app, subscribed.
nu11ptr|1 year ago
blopker|1 year ago
The work fzyzcjy and the community have put into calling Rust code from Dart seamlessly is such an asset to Flutter apps. I remade the popular image compression app ImageOptim in Flutter over a weekend because webp wasn't supported. After a little pain in the initial setup, I was able to call mature Rust image libraries using flutter_rust_bridge and a small wrapper[0]. It even handled all the parallelism for me.
The app ended up being more capable and faster than ImageOptim, largely just because of the Rust integration. Thank you fzyzcjy!
[0]: https://github.com/blopker/alic/blob/main/rust/src/api/compr...
fzyzcjy|1 year ago
unknown|1 year ago
[deleted]
bubblebeard|1 year ago
fzyzcjy|1 year ago
bobajeff|1 year ago
Tauri currently has poor support for mobile and Linux (because of the state of WebkitGtk).
Flutter uses Dart which is not widely used for anything else. Harder to learn as there is no MDN, w3schools or standard spec for it. Also Flutter Web has issues due to it's use of Canvas over the DOM.
IMO, electron is still the way to go for cross platform apps.
burakemir|1 year ago
One advantage of combining Rust with Flutter seems to be that Flutter is a whole framework already and one would be able to share code and data structures between server and client side.
A comparison with other ways Rust
fzyzcjy|1 year ago
sbt567|1 year ago
fzyzcjy|1 year ago
BodyCulture|1 year ago
nsriv|1 year ago
nu11ptr|1 year ago
nevi-me|1 year ago
pjmlp|1 year ago
fzyzcjy|1 year ago
danielvaughn|1 year ago
In theory shouldn't it be possible to create a programming language specifically for UI? Something that can be interfaced with from any major programming language. Kinda like protobuf with its IDL format, but instead of defining data, it's declaring user interfaces. Is that a crazy or stupid idea?
QT and XAML come to mind, but I believe QT is closed source (might be wrong about that), and XAML seems to have been dead in the water for a long time now (also might be wrong about that).
Tmpod|1 year ago
Anyway, there are some languages specifically desgined for making UIs. Qt has one of those, QML[1]. It's a "simple" language made precisely for UI development, that can be wired to C++, allowing you to write business logic in a general language, while keeping UI focused.
More interestingly, though, is Slint[2]. The language (and company behind it) was made by ex-QML devs which sought to improve the design, avoiding some pitfalls that QML ended up running into. It's core is written in Rust, but there are bindings for C++, JS and now Python too. They also have a focus on embedded devices, which ends up translating to always having good performance and memory footprint in mind, which is neat.
One of Slint's dev is ogoffart: https://news.ycombinator.com/user?id=ogoffart
[0]: https://www.qt.io/faq/tag/qt-open-source-licensing [1]: https://en.wikipedia.org/wiki/QML [2]: https://slint.dev
neonsunset|1 year ago
There is support and growing popularity for declarative UI defined in C#[3] and F#[4] instead though.
[0]: https://docs.avaloniaui.net/docs/basics/user-interface/intro...
[1]: https://platform.uno/docs/articles/getting-started/counterap...
[2]: https://learn.microsoft.com/en-us/dotnet/maui/xaml/fundament...
[3]: https://github.com/AvaloniaUI/Avalonia.Markup.Declarative
[4]: https://github.com/fsprojects/Avalonia.FuncUI
Zelphyr|1 year ago
_bent|1 year ago
sydbarrett74|1 year ago
satvikpendem|1 year ago
mdhb|1 year ago
polyaniline|1 year ago
fzyzcjy|1 year ago
abound|1 year ago
[1] https://redbadger.github.io/crux/
satvikpendem|1 year ago
[0] https://github.com/cunarist/rinf-status-report
[1] https://www.reddit.com/r/FlutterDev/comments/1dnwagk/flutter...
j-krieger|1 year ago
fzyzcjy|1 year ago
the__alchemist|1 year ago
api|1 year ago
cannibalXxx|1 year ago
[deleted]
webprofusion|1 year ago
jenadine|1 year ago
ramon156|1 year ago
mtizim|1 year ago
jurschreuder|1 year ago
Why not just use the Chrome render engine directly from Rust?
Why all the extra steps?
imadj|1 year ago
This is what projects like Tauri (in Rust) and Wails (in Go) are doing[0][1]. Utilizing Webview to develop applications, but they still don't support mobile, Tauri mobile is in beta.
Basically Tauri and Wails are on one side (HTML/CSS) trying to approach cross platform by supporting mobile platforms, while Flutter and Kotlin Compose Multiplatform started from the other side.
So it depends on your needs, web-first or mobile-first, and what platforms matter to you. So far Flutter is in the lead offering the most polished experience when it comes to supporting all platforms (Web, desktop, iOS, Android).
[0] https://github.com/tauri-apps/tauri
[1] https://github.com/wailsapp/wails
ThePhysicist|1 year ago
polyaniline|1 year ago
See Freya - which uses Skia - the render engine Flutter used until a while back.