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

插件详情v0.14.1

malison

一个用于浏览器的小型终端用户界面包。

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
521
喜欢数
11
Pub 分数
140

安装插件

flutter pub add malison

插件介绍

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

Malison 是一个轻量级的终端风格用户界面包,专为网络应用设计,使开发者能够直接在浏览器中创建复古风格的基于文本的界面。该包基于 Flutter 构建,支持交互式命令行体验,非常适合需要终端美学的游戏或工具。该包可无缝集成到多个平台,包括移动设备和桌面端,使其在跨平台开发中具有高度灵活性。它利用 Dart 的功能,高效地渲染和管理类似控制台的输出和输入。

适合场景

  • 创建基于浏览器的文本冒险游戏
  • 为网络应用程序构建终端模拟器
  • 开发交互式命令行工具
  • 模拟复古计算环境
  • 在Web应用程序中实现调试控制台

主要特点

  • 终端样式用户界面渲染
  • 跨平台兼容性
  • 简单命令输入处理
  • 轻量且快速的性能
  • 支持 ANSI 转义码
  • 内置文本格式化和样式

适合对象

  • 面向网络浏览器的游戏开发者
  • 互动教育工具的创作者
  • CLI 类 Web 界面的构建者
  • 复古游戏美学爱好者
  • 寻求最小化 UI 框架的开发人员

使用建议

  • 仅限终端样式设计模式
  • 不适合复杂的图形界面
  • 需要熟悉控制台/终端概念
  • 最适合特定用途,而非通用用户界面需求
  • 可能需要额外的逻辑来实现高级交互

原始 README

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

Malison is a small Dart library for drawing old school ASCII terminals in the browser. I harvested it from my roguelike game, Hauberk and it's aimed primarily at web games ASCII graphics. Think of it like curses for the web.

Using it

Add it to your package's pubspec:

dependencies:
  malison: any

Then use the library:

import 'dart:html';

import 'package:malison/malison.dart';

void main() {
  // Create or query a <canvas> element to bind it to.
  var canvas = new CanvasElement();
  document.body.children.add(canvas);

  // Create a new terminal. CanvasTerminal uses your browser's fonts.
  // RetroTerminal uses a built in DOS-style Code Page 437 font.
  var terminal = new RetroTerminal.dos(80, 40, canvas);

  // You can draw strings at given positions.
  terminal.writeAt(0, 0, "This is a terminal!");

  // You can control the foreground and background color.
  terminal.writeAt(0, 1, "This is blue on green", Color.blue, Color.green);

  // You can also draw individual glyphs -- character+color units.
  terminal.drawGlyph(3, 4, new Glyph.fromCharCode(CharCode.blackHeartSuit,
      Color.red, Color.white));

  // When you're done drawing, tell it to render all of the changes. It renders
  // in batches for performance.
  terminal.render();
}

Example

The repo includes a little example web application so you can see it in action. From the root of repo, run:

$ dart run build_runner serve

Then in your browser of choice, navigate to http://localhost:8080.

所属分类

依赖

依赖清单 2 项

源码仓库

使用此插件的项目

暂无相关数据。