DioxusLabs / dioxus

Fullstack app framework for web, desktop, mobile, and more.
https://dioxuslabs.com
Apache License 2.0
21.44k stars 826 forks source link

Add support for native platform ui such as gtk-rs, uikit, winapps, fltk #70

Closed prabirshrestha closed 7 months ago

prabirshrestha commented 2 years ago

Coping content from: https://old.reddit.com/r/rust/comments/rv9hru/releasing_dioxus_v01_a_new_rust_gui_toolkit_for/hrc0gbz/?context=3

prabirshrestha: This looks awesome. Are the plans to support platform native ui frameworks such as gtk-rs and UIKit? Having all controls would cause maintenance headache but I think having example on how to use Gtk-rs with dioxus with few controls would be a good start. This would allow me to easily create dioxus components backed by gtk-rs. I think this has a potential to take over react-native if it can support platform native controls. Having core component abstraction such as View, Text, Image could be a good start. https://reactnative.dev/docs/components-and-apis#basic-components Would love to see an official support for platform native ui components that doesn't depend on html and javascript.

jkelleyrtp: That's the plan! To pop the hood open a little bit, we have a type called Mutations which essentially describes what needs to be patched in the real renderer to make it look like the VirtualDom's understanding of the world. https://github.com/DioxusLabs/dioxus/blob/master/packages/core/src/mutations.rs You can implement entirely new elements, attributes, and listeners that integrate with the rsx! macro. Right now, the HTML namespace is supported through a collection of zero-sized-types and some traits to make things fit together: https://docs.rs/dioxus-html/0.1.3/dioxus\_html/ If you wanted to add a new fundamental language to rsx!, or even just components, it's entirely possible. I'd love to see native macOS / GTK / win apps using the same set of common primitives.

(creating this issue so I can subscribe to it and get notified on updates).

I'm personally interested in native platform ui without html and javascript. For gtk-rs here are some good references:

ui kit resources:

ealmloff commented 1 year ago

There are now two in progress implementations of native renderers for Dioxus:

Both of these use cross platform rendering layers instead of native UI, but there are also more tools built out to create native UI renderers for Dioxus. Specifically, native-core provides a nice interface for incremental style propagation.

jkelleyrtp commented 7 months ago

Hi! This issue is great but isn't super actionable for the repo at this time.

If anyone wants to take on these projects, feel free, but the strategy we're going with is Blitz.

Blitz is currently being revamped at http://github.com/jkelleyrtp/stylo-dioxus. We're using stylo (servo) directly. While we'd love to support gtk or cacao, it's not high on our list (at the moment). Generally, we think we can do a better job at serving the native needs by going through WGPU and shelling out to native widgets where possible rather than go 100% native.