
marc2332/freya
Developer toolsこのページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。 原文を見る
Skiaによる🎨 Rust向けの🦀クロスプラットフォームかつ非ウェブのGUIライブラリ。
概要
:警告:最近、Freyaの大部分をhttps://github.com/marc2332/freya/pull/1351,で書き直したので、メインブランチは最新の安定版と大きく異なっています。 Freyaのコンポーネントモデルは、依存する状態が変わると自動的に再レンダリングされる再利用可能なUI要素を作成できます。コンポーネントは独自の内部状態を保持したり、共有状態をサブスクライブしたりでき、出力としてUIを生成します。コンポーネント特性を実装したタイプはコンポーネントであり、root(アプリ)コンポーネントは単に関数として扱えます。組み込みの例としてはButtonやSwitchのようなコンポーネントがあります。 Freyaには、Button、Switch、Sliderのようなシンプルなものから、VirtualScrollView、カレンダー、ColorPickerなどの複雑なものまで、標準のコンポーネントセットが付属しています。 examplesフォルダでcomponent_で始まるすべての例を確認できます。 色、サイズ、位置、その他の視覚的特性のトランジションを作成します。
概要(AI 翻訳)
ウェブサイト |ドキュメント |Discord |連絡先
FreyaはRust 🦀用のクロスプラットフォーム、ネイティブ、宣言型GUIライブラリです。
使用法 📜
最新の安定版リリース:
次回リリース:
main 枝:
試してみ🚀る
Development Setupを用意しておいてください。
⚠️ このリポジトリはgitのサブモジュールを使用しています。
--recurse-submodules]なしのクローンはサンプルのコンパイルに失敗します。
サブモジュールなしですでにクローン済みですか?
git submodule update --init --recursiveを走って取りに行ってください。
次に例を挙げてみましょう。
⚠️ もしWindowsで[[ T3]]を使っていてコンパイルエラーが出るなら、この問題を確認してみてはどうでしょうか。
構成要素と状態
Freyaのコンポーネントモデルは、依存する状態が変わると自動的に再レンダリングされる再利用可能なUI要素を作成できます。コンポーネントは独自の内部状態を保持したり、共有状態をサブスクライブしたりでき、出力としてUIを生成します。Component特性を実装した型はコンポーネントであり、ルート(app)コンポーネントは単なる関数でもあります。組み込みの例として、ButtonやSwitchのようなコンポーネントがあります。
箱から出した部品
このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。
README
以下は原文 README の抜粋です。原文を見る。
Freya 🦀
Website | Documentation | Discord | Contact
Freya is a cross-platform, native, declarative GUI library for Rust 🦀.
Usage 📜
Latest stable release:
freya = "0.4"
Next release:
freya = "0.5.0-rc.13"
main branch:
freya = { git = "https://github.com/marc2332/freya", branch = "main" }
Trying it out 🚀
Make sure to have Development Setup ready.
⚠️ This repo uses git submodules, cloning without
--recurse-submoduleswill make the examples fail to compile.
git clone --recurse-submodules https://github.com/marc2332/freya.git
cd freya
Already cloned without submodules? Run
git submodule update --init --recursiveto fetch them.
Then run an example:
cargo run --example counter
⚠️ If you happen to be on Windows using
windows-gnuand get compile errors, maybe go check this issue.
Components & State
Freya’s component model lets you create reusable UI elements that automatically re-render when the state they depend on changes. Components can hold their own internal state or subscribe to shared state, and they produce UI as their output. Any type that implements the Component trait can be a component, while the root (app) component can simply be a function. Built-in examples include components like Button and Switch.
fn app() -> impl IntoElement {
let mut count = use_state(|| 4);
let counter = rect()
.width(Size::fill())
.height(Size::percent(50.))
.center()
.color((255, 255, 255))
.background((15, 163, 242))
.font_weight(FontWeight::BOLD)
.font_size(75.)
.shadow((0., 4., 20., 4., (0, 0, 0, 80)))
.child(count.read().to_string());
let actions = rect()
.horizontal()
.width(Size::fill())
.height(Size::percent(50.))
.center()
.spacing(8.0)
.child(
Button::new()
.on_press(move |_| {
*count.write() += 1;
})
.child("Increase"),
推奨ツール
別のキーワードを試すか、フィルタを外してください。
インストール
npx skillfish add marc2332/freya