パッケージ、リポジトリ、アプリカテゴリを検索

custom_timer のカバー
パッケージ詳細v0.2.3

custom_timer

コントローラー付きのカスタマイズ可能なタイマーを作成するためのFlutterパッケージ。

AndroidiOSWebmacOSWindowsLinux
30日間ダウンロード
1110
いいね数
147
Pub ポイント
150

パッケージをインストール

flutter pub add custom_timer

パッケージ概要

公開情報に基づく選定ガイドです。参考としてご利用ください。

開発者が高度にカスタマイズ可能なタイマーを構築できるFlutterパッケージで、組み込みコントローラー機能を備えています。リアルタイム更新、正確なタイミング制御、複数のプラットフォームでのFlutterアプリへのシームレスな統合をサポートしています。タイマーは専用コントローラーを通じて一時停止、再開、リセット、モニタリングが可能で、カウントダウンやストップウォッチ機能、または任意の時間ベースのUIコンポーネントに最適です。柔軟性と使いやすさを重視して設計されており、Android、iOS、Web、macOS、Windows、Linuxで動作します。

用途

  • カウントダウンタイマー
  • ストップウォッチアプリケーション
  • 時間制限付きのユーザーインタラクション
  • リアルタイムでの進捗追跡
  • インタラクティブな学習アプリ
  • ゲームタイマー

主な機能

  • カスタマイズ可能なタイマー期間
  • 状態管理用の組み込みコントローラー
  • 一時停止、再開、リセット機能
  • クロスプラットフォーム互換性
  • リアルタイムコールバックイベント
  • Flutter ウィジェットとの簡単な統合

適している対象

  • タイムセンシティブな機能を開発する開発者
  • 正確なタイミング制御を必要とするアプリケーション
  • 教育または生産性ツール
  • ゲーム化アプリケーション
  • 動的な時刻表示を必要とするUIコンポーネント

注意事項

  • タイマーのライフサイクルを手動で処理する必要があります
  • 複雑なスケジューリングには追加の論理が必要になる場合があります
  • 通常の使用ケースを超える高頻度の更新には最適化されていません
  • 組み込みのスタイルオプションが限定的(カスタムウィジェットの構成が必要)

元の README

関連するソースリポジトリの README 原文のスナップショットです。最新の内容はリポジトリをご覧ください。

Custom Timer ⌛

A Flutter package to create a customizable timer.


🎉 Features

  • Timer controller.
  • Auto count up / down timer.
  • Custom builder.
  • Millisecond support.

📌 Usage


example1


Add SingleTickerProviderStateMixin to your stateful widget. 👇

class _MyAppState extends State<MyApp> with SingleTickerProviderStateMixin {

Then define a CustomTimer controller

late CustomTimerController _controller = CustomTimerController(
  vsync: this,
  begin: Duration(hours: 24),
  end: Duration(),
  initialState: CustomTimerState.reset,
  interval: CustomTimerInterval.milliseconds
);

And you are ready to use the timer:

CustomTimer(
  controller: _controller,
  builder: (state, time) {
    // Build the widget you want!🎉
    return Text(
      "${time.hours}:${time.minutes}:${time.seconds}.${time.milliseconds}",
      style: TextStyle(fontSize: 24.0)
    );
  }
)

Now you can use the controller methods:

_controller.reset();
_controller.start();
_controller.pause();
_controller.finish();

_controller.add(Duration(minutes: 30));
_controller.subtract(Duration(minutes: 30));
_controller.jumpTo(Duration(hours: 12));

You can also set the begin or end, even with the counter running:

_controller.begin = Duration();
_controller.end = Duration(hours 12);

And add listeners to state changes or just use the properties when you need them:

_controller.state.addListener(() {
  print(_controller.state.value); // 👉 CustomTimerState.paused
  print(_controller.remaining.value.hours); // 👉 12h
});

Remember to dispose when you are no longer using it.


🔧 Installation

Add this to your package's pubspec.yaml file:

dependencies:
  custom_timer: ^0.2.3

Install it:

$ flutter pub get

Import the package in your project:

import 'package:custom_timer/custom_timer.dart';

🙇 Author


Hi there 👋 This package is in development so if you find a bug or have a suggestion please let me know so we can improve it! 😃 If you want to motivate me to continue, you can give me a cup of coffee ☕ and I will get a lot of energy out of it.


Buy Me A Coffee

カテゴリー

ソースリポジトリ

このパッケージを使用しているプロジェクト