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

插件详情v2.0.1

dolumns

一个用于将文本输出格式化为列的 Dart 库。适用于在终端中打印表格数据。

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
2090
喜欢数
22
Pub 分数
145

安装插件

flutter pub add dolumns

插件介绍

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

Dolumns 是一个 Dart 库,旨在将文本输出格式化为对齐的列,非常适合在终端环境中显示表格数据。它提供了简单高效的工具,用于以一致的间距和对齐方式组织文本,从而提升基于控制台的应用程序的可读性。该库轻量且与平台无关,支持所有主要的 Flutter 平台,包括 Android、iOS、Web、macOS、Windows 和 Linux。它特别适用于 CLI 工具、调试输出或任何需要整洁文本布局而无需外部依赖的应用。

适合场景

  • 显示命令行表格
  • 格式化调试日志
  • 创建终端仪表板
  • 在 CLI 应用中生成报告
  • 在控制台中呈现结构化数据

主要特点

  • 轻松列对齐
  • 灵活的内边距和间距
  • 跨平台兼容性
  • 最小 API 表面
  • 支持自定义分隔符
  • 无外部依赖

适合对象

  • CLI 工具开发者
  • 基于控制台的应用程序
  • 调试工具
  • 终端中的数据可视化
  • 教育或学习工具

使用建议

  • 不适合用于GUI表格渲染
  • 有限的样式选项
  • 最适合等宽字体
  • 不支持颜色等高级格式化
  • 主要用于简单的文本布局
  • 需要手动处理换行

原始 README

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

A library for formatting text output into columns.

Dart CI

Usage

A simple usage example:

import 'package:dolumns/dolumns.dart';

main() {
  final columns = dolumnify([
    ['provider', '4.0.2'],
    ['http', '0.12.0+4'],
    ['shared_preferences', '0.5.6+1'],
    ['sentry', '3.0.1'],
  ]);
  print(columns);
}

will output:

provider            4.0.2   
http                0.12.0+4
shared_preferences  0.5.6+1 
sentry              3.0.1   

You can also supply a custom column splitter, (...], columnSplitter: ' | '); will give:

provider           | 4.0.2   
http               | 0.12.0+4
shared_preferences | 0.5.6+1 
sentry             | 3.0.1 

Columns with headers are possible with a custom header separator, provide the header in the first list item:

import 'package:dolumns/dolumns.dart';

main() {
  final columns = dolumnify([
    ['PACKAGES', 'VERSION'],
    ['provider', '4.0.2'],
    ['http', '0.12.0+4'],
    ['shared_preferences', '0.5.6+1'],
    ['sentry', '3.0.1'],
  ], columnSplitter: ' | ', headerIncluded: true, headerSeparator: '=');
  print(columns);
}

will output:

PACKAGES           | VERSION 
=============================
provider           | 4.0.2   
http               | 0.12.0+4
shared_preferences | 0.5.6+1 
sentry             | 3.0.1   

see dolumns_example.dart example file for full details.

Note you can pass in objects of any type, dolumn will call toString() on every object passed in.

API inspired by the columinfy npm package.

Features and bugs

Please file feature requests and bugs at the issue tracker.

所属分类

源码仓库

使用此插件的项目

暂无相关数据。