Flutter Ruffle is a small, experimental Flutter wrapper around the Rust-based Ruffle runtime.
This repository is primarily a simple implementation/proof-of-concept. Large parts of the code were generated with AI assistance, so stability and correctness are not guaranteed. Please use at your own risk.
The UI is inspired by ruffle-android.
- Open and play local SWF files.
- Load SWF from HTTP/HTTPS URLs.
- Desktop offscreen rendering with Flutter Texture (PixelBuffer).
- Platform-surface rendering where available (e.g. iOS/macOS/Android).
- Basic safety UX for network behaviors (e.g. confirm before allowing SWF socket connections).
![]() |
![]() |
- Android
- iOS
- macOS
- Windows
- Linux
Web is not supported.
This project wraps the Ruffle engine into a Flutter app via an FFI plugin:
- Flutter UI (Dart): file/URL selection, player controls, HUD, virtual input overlays.
- Background isolate: runs a worker that communicates with the native side and keeps the UI responsive.
- FFI bridge: implemented with
flutter_rust_bridgein theruffleplugin package. - Rendering paths:
- Platform surface mode (iOS/macOS/Android): the native side renders into a platform surface (e.g. CoreAnimation layer or ANativeWindow).
- Offscreen mode (Windows/Linux): a simple path that captures RGBA frames on the native side and shows them in Flutter via
Texture/PixelBuffer (channel:ruffle/texture).
Prerequisites:
- Flutter is managed via FVM. Use
fvm flutterinstead offlutter. - Git submodules are used for third-party sources.
- Rust toolchain:
packages/ruffleuses a pinned nightly toolchain (seepackages/ruffle/rust/rust-toolchain.toml). - Ruffle is pinned by git submodule commit (not automatically tracking upstream). Update intentionally by changing the submodule commit in this repository.
Commands:
git submodule update --init --recursive
fvm flutter pub get
fvm flutter runRelease builds:
fvm flutter build apk --release
fvm flutter build windows --release
fvm flutter build macos --release
fvm flutter build ios --release
fvm flutter build linux --releaselib/: Flutter app UI and player logic.packages/ruffle/: Flutter FFI plugin bridging Dart ↔ Rust (and desktop texture code).packages/ruffle/third_party/ruffle/: Ruffle upstream (git submodule).
This repository integrates upstream projects (e.g. Ruffle). Licensing follows their respective licenses. Please review upstream licenses before redistribution.
Flutter Ruffle 是一个基于 Flutter 的 Ruffle 简单封装(偏实验性质)。
本仓库主要用于做一个“能跑起来”的简单实现/概念验证,代码大量由 AI 辅助生成,稳定性与正确性不做保证,请自行评估风险后使用。
界面参考 ruffle-android。
- 打开并播放本地 SWF 文件。
- 支持通过 HTTP/HTTPS 链接加载 SWF。
- 桌面端使用 Flutter Texture(PixelBuffer)进行离屏渲染显示。
- 在支持的平台上走原生 Surface 渲染(例如 iOS/macOS/Android)。
- 对部分网络行为提供基础安全交互(例如 SWF 发起 Socket 连接前弹窗确认)。
![]() |
![]() |
- Android
- iOS
- macOS
- Windows
- Linux
不支持 Web 平台。
本项目将 Ruffle 引擎通过 FFI 插件接入 Flutter 应用:
- Flutter UI(Dart):文件/链接选择、播放器控制、HUD、虚拟键盘/手柄等。
- 后台 Isolate:通过 worker 在后台处理与原生侧的通信,避免阻塞 UI。
- FFI 桥接:
packages/ruffle使用flutter_rust_bridge实现 Dart ↔ Rust 调用。 - 两条渲染链路:
- 平台 Surface 模式(iOS/macOS/Android):原生侧直接渲染到平台提供的 Surface(如 CoreAnimation Layer、ANativeWindow)。
- 离屏模式(Windows/Linux):比较简单的实现:原生侧抓取 RGBA 帧,通过
Texture/PixelBuffer(通道:ruffle/texture)在 Flutter 中显示。
前置要求:
- Flutter 通过 FVM 管理,请使用
fvm flutter。 - 三方源码使用 Git submodule 管理。
- Rust 工具链:
packages/ruffle使用固定版本的 nightly(见packages/ruffle/rust/rust-toolchain.toml)。 - Ruffle 通过 git submodule 的 commit 固定(不会自动跟随上游变化),需要手动更新本仓库记录的 submodule commit 才会升级。
常用命令:
git submodule update --init --recursive
fvm flutter pub get
fvm flutter run打包命令(示例):
fvm flutter build apk --release
fvm flutter build windows --release
fvm flutter build macos --release
fvm flutter build ios --release
fvm flutter build linux --releaselib/:Flutter 应用 UI 与播放逻辑。packages/ruffle/:Flutter FFI 插件(Dart ↔ Rust)以及桌面纹理相关代码。packages/ruffle/third_party/ruffle/:Ruffle 上游仓库(git submodule)。
本仓库集成了上游项目(例如 Ruffle)。具体许可协议以各上游仓库为准,分发/商用前请自行确认并遵循对应许可。

