搜索插件、代码仓与 APP 分类

xterm 封面
插件详情v4.0.0

xterm

xterm.dart 是一个适用于 Flutter 应用程序的快速且功能齐全的终端模拟器,支持移动和桌面平台。

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
24.2万
喜欢数
239
Pub 分数
140

安装插件

flutter pub add xterm

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

xterm.dart 是一个高性能的终端模拟器,适用于 Flutter,使开发者能够在移动和桌面应用程序中嵌入功能完整的终端界面。它支持 ANSI 转义序列、键盘输入处理以及跨平台的流畅文本渲染。专为集成到 CLI 工具、开发环境或远程 shell 客户端而设计,可在 Flutter 应用中提供无缝的终端体验。该包持续维护,并兼容 Android、iOS、Web、macOS、Windows 和 Linux。

适合场景

  • 在代码编辑器应用中嵌入终端
  • 构建远程 SSH 客户端
  • 创建交互式命令行工具
  • 开发开发者控制台界面
  • 支持桌面应用程序中的终端工作流

主要特点

  • 完整的 ANSI 转义序列支持
  • 跨平台兼容性
  • 高效的文本渲染
  • 键盘输入处理
  • 可自定义的主题
  • 滚动回溯和换行

适合对象

  • Flutter 开发人员构建基于终端的应用程序
  • 需要嵌入式 shell 访问权限的工具
  • 教育类应用程序,教授命令行使用
  • 远程开发环境
  • CLI 工具集成

使用建议

  • 需要了解终端协议
  • 可能需要额外的样式以保持UI一致性
  • 性能取决于终端内容的复杂度
  • 有限的内置命令执行(需要外部进程)
  • 未经优化,不适合用于重型终端仿真

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

xterm.dart

Actions Package version GitHub repo size GitHub issues GitHub pull requests

xterm.dart is a fast and fully-featured terminal emulator for Flutter applications, with support for mobile and desktop platforms.

This package requires Flutter version >=3.0.0

Screenshots

Features

  • 📦 Works out of the box No special configuration required.
  • 🚀 Fast Renders at 60fps.
  • 😀 Wide character support Supports CJK and emojis.
  • ✂️ Customizable
  • ✔ Frontend independent: The terminal core can work without flutter frontend.

What's new in 3.0.0:

  • 📱 Enhanced support for mobile platforms.
  • ⌨️ Integrates with Flutter's shortcut system.
  • 🎨 Allows changing theme at runtime.
  • 💪 Better performance. No tree rebuilds anymore.
  • 🈂️ Works with IMEs.

Getting Started

1. Add this to your package's pubspec.yaml file:

dependencies:
  ...
  xterm: ^3.2.6

2. Create the terminal:

import 'package:xterm/xterm.dart';
...
terminal = Terminal();

Listen to user interaction with the terminal by simply adding a onOutput callback:

terminal = Terminal();

terminal.onOutput = (output) {
  print('output: $output');
}

3. Create the view, attach the terminal to the view:

import 'package:xterm/flutter.dart';
...
child: TerminalView(terminal),

4. Write something to the terminal:

terminal.write('Hello, world!');

Done!

More examples

  • Write a simple terminal in ~100 lines of code: https://github.com/TerminalStudio/xterm.dart/blob/master/example/lib/main.dart

  • Write a SSH client in ~100 lines of code with dartssh2: https://github.com/TerminalStudio/xterm.dart/blob/master/example/lib/ssh.dart

For a complete project built with xterm.dart, check out TerminalStudio.

Features and bugs

Please file feature requests and bugs at the issue tracker.

Contributions are always welcome!

License

This project is licensed under an MIT license.

所属分类

依赖

依赖清单 5 项

源码仓库

使用此插件的项目