smladeoye / flutter-simple-timer

A Simple Flutter Timer Widget with various customizable features.
MIT License
19 stars 7 forks source link

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:

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