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

simple_timer のカバー
パッケージ詳細v2.0.0

simple_timer

さまざまなカスタマイズ可能なオプションを備えた、タイマーの進行状況を表示するシンプルなタイマー用ウィジェットです。

30日間ダウンロード
69
いいね数
55
Pub ポイント
70

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

flutter pub add simple_timer

パッケージ概要

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

Flutterパッケージで、カウントダウンまたはストップウォッチの進行状況を表示するためのシンプルでカスタマイズ可能なタイマー小道具を提供します。テキストスタイル、色、アニメーションオプションなど、さまざまな視覚的および機能的なカスタマイズが可能です。最小限のセットアップでリアルタイムの時間追跡が必要なアプリに最適です。軽量で、既存のUIに簡単に統合できます。追加の構成なしに、複数のプラットフォーム間でスムーズに動作します。

用途

  • フィットネスアプリにおけるカウントダウンタイマー
  • 生産性ツールにおけるストップウォッチ機能
  • 教育クイズでタイマーが表示されます
  • ゲーム内のリアルタイム進捗インジケーター
  • タスクマネージャーにおける時間ベースのリマインダー

主な機能

  • カスタマイズ可能なタイマーの外観
  • スムーズな進行アニメーション
  • カウントダウンおよびストップウォッチモードのサポート
  • Flutter ウィジェットとの簡単な統合
  • カスタマイズ可能なテキストとカラーのテーマ

適している対象

  • タイムトラッキング機能を構築している開発者
  • クリーンなタイマー コンポーネントが必要な UI デザイナー
  • 最小限のタイマー複雑性を必要とするアプリ
  • 初心者のFlutter開発者が状態管理を学んでいる

注意事項

  • 基本的なタイマー機能に限定される
  • 継続的なタイマー用の組み込みの永続化なし
  • 複数の同時実行タイマーをサポートしていません
  • プラットフォーム固有の振る舞いは異なる場合があります
  • タイマーのライフサイクルを手動で処理する必要があります

元の README

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

SimpleTimer

A Simple Timer Widget that displays the timer progress with various customizable options.

Installing

To Start using this library include simple_timer as a dependency in your puspec.yaml file. Make sure to include the latest version.

Pub link: https://pub.dev/packages/simple_timer

Usage

To use the widget, import the package in your project

import 'package:simple_timer/simple_timer.dart';

The timer can be controlled in two ways:

  • Using a TimerController (preferred) - The TimerController is a convenience wrapper (subclass) of an AnimationController and needs a TickerProvider, so be sure to extend a TickerProvider in your class. Declare and instantiate your timer controller like below:

    // declaration
    TimerController _timerController;
    
    // instantiation
    _timerController = TimerController(this);
    

    Note: Remember to dispose the TimerController

    and set the controller property to the TimerController object like below:

    Container(
        child: SimpleTimer(
            controller: _timerController,
            duration: Duration(seconds: 10),
        )
    )
    

    TimerController methods:

    Method Description
    start Starts the timer e.g. (_timerController.start())
    pause Pauses the timer e.g. (_timerController.pause())
    reset Resets the timer e.g. (_timerController.reset())
    restart Restarts the timer e.g. (_timerController.restart())
    add Increases time left by the specified duration i.e. allows more time e.g. (_timerController.add(Duration(seconds: 10)))
    subtract Decreases time left by the specified duration i.e. reduces the time e.g. (_timerController.subtract(Duration(seconds: 10)))
  • Setting the Status - The timer can also be controler by passing a TimerStatus value to the status property; like below:

    Container(
        child: SimpleTimer(
            status: TimerStatus.start,
            duration: Duration(seconds: 10),
        )
    )
    

Note: The SimpleTimer widget uses its parent size.

Customizable Options

There are various customizable options provided by the SimpleTimer widget, see below:

Property Description Value Type Default Value
duration The duration of the timer Duration
controller A TimerController to control the timer. If this is provided then status must be null. TimerController
status An alternative to the controller that sets the status of the timer. If provided, controller must be null TimerStatus
timerStyle Sets the look of the animated timer widget TimerStyle ring
delay Sets a start delay for timer - i.e. delays the start of the timer by the specified duration Duration Duration(seconds: 0)
backgroundColor The background color of the inner shape (circle) of the timer Color grey
progressIndicatorColor The color of the animating progress indicator. Color green
progressIndicatorDirection The rotating direction of the timer's progress indicator TimerProgressIndicatorDirection clockwise
displayProgressIndicator Sets whether to show the progress indicator bool true
displayProgressText Sets whether to show the progress text bool true
progressTextStyle The TextStyle used by the progress text. TextStyle
progressTextCountDirection The counting direction of the text displayed by the timer TimerProgressTextCountDirection count_down
progressTextFormatter A callback function to format the text displayed by this Timer. String Function(Duration) displays duration in MM:SS format
onStart Callback executed when the timer starts counting VoidCallback
onEnd Callback executed when the timer has finished counting VoidCallback
valueListener The callback executed for each change in the time elapsed void Function(Duration)

Pub link: https://pub.dev/packages/simple_timer

Demo - Controlling the Timer Status

simple_timer_demo_01

Demo - Customizable options

simple_timer_demo_02

カテゴリー

ソースリポジトリ

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

データはまだありません。