搜尋套件、儲存庫與 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.

所屬分類

原始碼儲存庫

使用此套件的專案

暫無相關資料。