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

cli_spin 封面
插件详情v1.0.1

cli_spin

一个 Dart 包,通过为同步和异步操作显示简洁的终端旋转进度条来提升用户体验。

AndroidiOSmacOSWindowsLinux
近 30 天下载
9850
喜欢数
33
Pub 分数
150

安装插件

flutter pub add cli_spin

插件介绍

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

cli_spin 是一个 Dart 包,旨在通过在同步和异步操作期间显示流畅的动画转盘来改善终端用户体验。它可无缝集成到 CLI 应用程序中,为用户提供处理任务时的视觉反馈。该转盘支持 Android、iOS、macOS、Windows 和 Linux 等多个平台,确保在不同环境中行为一致。通过 `flutter pub add cli_spin` 即可轻松设置,开发者可以为其命令行工具增添专业外观的进度指示器。该包轻量且专注于简洁与可靠性。

适合场景

  • 在CLI工具中显示进度
  • 增强异步操作期间的用户反馈
  • 改进命令行脚本中的用户体验
  • 为长时间运行的任务提供视觉提示
  • 在控制台应用程序中集成流畅的旋转进度条

主要特点

  • 支持同步和异步操作
  • 跨平台兼容性
  • 最小 API 表面
  • 流畅的终端旋转动画
  • 与 Flutter CLI 应用的轻松集成

适合对象

  • CLI 开发者
  • 命令行工具创建者
  • Flutter 开发人员构建控制台工具
  • 寻求简单进度指示器的用户
  • 需要轻量级终端用户体验增强的项目

使用建议

  • 仅限基于终端的输出
  • 无自定义旋转样式
  • 不支持非终端环境
  • 需要手动控制旋转器生命周期
  • 依赖于平台特定的终端功能

原始 README

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

A Dart package that enhances the user experience by displaying a sleek terminal spinner for both sync and async operations.

preview

Features

  • 80+ predefined spinners accessible via CliSpinners
  • Easily change color of spinners and/or text with use of CliSpinnerColor helper
  • Define your own character sets (frames) and intervals for your custom spinners
  • Custom spinner text (w/ separate suffix and prefix options)
  • Start/stop methods
  • Stop and persist the spinner with custom text and symbol
  • Predefiend success, fail, warn and info methods (cross-platform compatible)

Getting started

TODO: List prerequisites and provide or point to information on how to start using the package.

Usage example

import 'dart:async';
import 'package:cli_spin/cli_spin.dart';

void main() {
  // Instantiate spinner
  final spinner = CliSpin(
    text: 'Loading data...',
    spinner: CliSpinners.line,
  ).start(); // Chaining methods

  Timer(Duration(milliseconds: 1000), () {
    // Change spinner color
    spinner.color = CliSpinnerColor.yellow; 
    
    // Change spinner text
    spinner.text = 'Still loading, please wait...';

    Timer(Duration(milliseconds: 1000), () {
      // Alias for `stopAndPersist(...)` method
      spinner.success('Data loaded successfully.');
    });
  });
}

Additional information

Inspired by the ora library written in Javascript.

所属分类

依赖

依赖清单 2 项

  • ansi_strip^0.1.1+1
  • string_width^0.1.5

源码仓库

使用此插件的项目

暂无相关数据。