A template for a Rust Application using Slint with material components. Based on the material gallery.
This template helps you get started developing a Rust application with Slint as a toolkit
for the user interface and the material component set. It demonstrates the integration between the .slint
UI markup and Rust code, how to react to callbacks, get and set properties, and use of all available
material components for Slint.
The material components are currently available as a technical preview. Some components are still missing and changes to the api are possible. We will inform as soon as the component set is read for release.
We recommend using an IDE for development, along with our LSP-based IDE integration for .slint
files. You can also load this project directly in Visual Studio Code and install our Slint extension.
- Install Rust by following its getting-started guide.
Once this is done, you should have the
rustc
compiler and thecargo
build system installed in yourPATH
. - Download and extract the ZIP archive of this repository.
- Rename the extracted directory and change into it:
mv slint-rust-template-main my-project cd my-project
-
Build with
cargo
:cargo build
-
Run the application binary:
cargo run
You can then use wasm-pack (which you may need to obtain with cargo install wasm-pack
).
This will generate the wasm in the ./pkg
directory, which the index.html
file will open.
Since wasm files cannot be served from file://
URL, you need to open a wab server to serve
the content
wasm-pack build --release --target web
python3 -m http.server
First, set up your Android environment. Then, you can run the demo on an Android device with the following command:
cargo apk run --target aarch64-linux-android --lib
We hope that this template helps you get started, and that you enjoy exploring making user interfaces with Slint. To learn more
about the Slint APIs and the .slint
markup language, check out our online documentation. Check out
also the material components documentation
Don't forget to replace the contents of this readme with your own project details. As well as dit the name =
field in Cargo.toml
to match the name of your
project.