Skip to content
项目

关于

一个功能强大的终端用户界面框架,设计灵感来自 Flutter,可用 Dart 构建美观的命令行应用。

开发工具

这些数字如何统计

实测星标增长

24小时
0
7天
+1
15天
+1
1个月
正在收集历史

各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。

README.md

原文

CI Pub Version License Website Documentation

Website | Docs | pub.dev | Quick Start

If you know Flutter, you know Nocterm. Build terminal UIs with the same patterns—StatefulComponent, setState(), Column, Row, and hot reload.

Nocterm Demo

Installation

dependencies:
  nocterm: ^0.9.0

Quick Start

import 'package:nocterm/nocterm.dart';

void main() {
  runApp(const Counter());
}

class Counter extends StatefulComponent {
  const Counter({super.key});

  @override
  State<Counter> createState() => _CounterState();
}

class _CounterState extends State<Counter> {
  int _count = 0;

  @override
  Component build(BuildContext context) {
    return Focusable(
      focused: true,
      onKeyEvent: (event) {
        if (event.logicalKey == LogicalKey.space) {
          setState(() => _count++);
          return true;
        }
        return false;
      },
      child: Center(
        child: Text('Count: $_count'),
      ),
    );
  }
}

Run with hot reload:

dart --enable-vm-service your_app.dart

Testing

Test your TUI components just like Flutter widgets:

await testNocterm('counter test', (tester) async {
  await tester.pumpComponent(Counter());
  await tester.sendKey(LogicalKey.space);

  expect(tester.terminalState, containsText('Count: 1'));
});

Documentation

See the full documentation for guides on components, state management, testing, and more.

Community

Packages

Package Description
nocterm_bloc Bloc state management for Nocterm
nocterm_lints IDE assists — wrap with, swap, move, convert to stateful/stateless

Built with Nocterm

Project Description
vide_cli Multi-agent coding IDE for the terminal
nocterm_3d Experimental 3D renderer for the terminal
cow Local LLM chat client powered by llama.cpp
snake Classic Snake for the command line
minesweeper Classic Minesweeper for the command line
simutil Quick launch iOS simulators / Android emulators and more

Built something with Nocterm? Open an issue to get it listed here!

Contributing

Git Hooks

We use hooksman to manage git hooks. To install the hooks, run:

dart run hooksman

License

MIT

探索相关项目

加载中…