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

插件详情v2.2.2

timer_count_down

简单的倒计时计时器。用于创建一个简单计时器。纯代码实现。

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
3万
喜欢数
200
Pub 分数
150

安装插件

flutter pub add timer_count_down

插件介绍

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

一个简单的纯 Dart 倒计时计时器包,专为创建基本计时器而设计,设置简单。支持包括 Android、iOS、Web、macOS、Windows 和 Linux 在内的多个平台。适用于需要简单倒计时功能且无需复杂依赖的应用程序。该包轻量且易于集成,非常适合用于游戏中的计时器、提醒或限时挑战等场景。

适合场景

  • 在应用程序中创建简单的倒计时
  • 实施限时挑战
  • 构建提醒或警报系统
  • 为教育类应用程序添加计时器
  • 使用游戏机制
  • 显示到期时间指示器

主要特点

  • 轻量级且纯 Dart
  • 跨平台支持
  • 倒计时的简单 API
  • 无外部依赖
  • 与 Flutter 的轻松集成
  • 可配置的倒计时持续时间

适合对象

  • 初学者 Flutter 开发者
  • 简单的计时器实现
  • 需要基本倒计时逻辑的应用
  • 依赖最少的项目
  • 基于时间的 UI 组件

使用建议

  • 有限的高级功能
  • 不适合复杂的定时场景
  • 无内置的暂停/恢复功能
  • 需要手动处理回调
  • 仅适用于基本倒计时需求
  • 超出基本设置的自定义

原始 README

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

Simple Count Down

pub

A highly customizable countdown widget for Flutter, with support for custom styling, intervals, and onFinished callbacks.

Preview

Installing

  • Add the latest version of the package to your pubspec.yaml file in the dependency section.
  dependencies:
    flutter:
      sdk: flutter

    timer_count_down: ^2.2.2

Run this in your terminal or click on pub get

$ flutter pub get

How to use

Simple example for the usage of the package is shown below.

class MyWidget extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Countdown(
      seconds: 20,
      build: (BuildContext context, double time) => Text(time.toString()),
      interval: Duration(milliseconds: 100),
      onFinished: () {
        print('Timer is done!');
      },
    );
  }
}

Example

For pause, restart and resume you need to use CountdownController. For an example of using the package, please check the example folder. Otherwise, keep reading and keep going!

所属分类

源码仓库

使用此插件的项目