count_down_time 0.0.8

SDKflutter
Platformandroidioswindowslinuxmacosweb

A count-down timer package with options to reset and set current time.

count_down_time

Count Down Time: Tests

This widget render a simple count-down time.

Menu float - example

Getting Started

Below the simple example:

Column(
  mainAxisSize: MainAxisSize.max,
  mainAxisAlignment: MainAxisAlignment.center,
  crossAxisAlignment: CrossAxisAlignment.center,
  children: [
  CountDownTime(
  timeId: 'simple-timer',
  timeStartInSeconds: 30,
  onChangeTime: (time) {
    setState(() {
      timeoutReached = false;
    });
  },
  onTimeOut: () {
    setState(() {
      timeoutReached = true;
    });
  },
  ),
  Container(
    padding: const EdgeInsets.only(top: 10),
    alignment: Alignment.center,
    child: ElevatedButton(
      child: const Text('Restart count'),
      onPressed: () {
        CountDownTimeController.pushTimerRenewId(widget.id);
      },
    )),
  Padding(
    padding: const EdgeInsets.only(top: 10),
    child: Text(timeoutReached ? 'Timeout Reached' : ''))
  ])

For more details see the project demo in the demo folder.

About the props:

PropTypeDescription
timeIdStringDefine the timer id.
timeStartInSecondsintDefine the time to start the count-down in seconds.
textStyle (optional)textStyleDefine the style of timer.
onTimeOutFunctionDefine the callback when the count-down is finished.
onChangeTimeFunction(int time)Define the callback when the count-down is changed.

About the factory:

The widget has two factories to work with minutes and hours on count-down start. See the example below:

Minutes:

CountDownTime.minutes(
  timeStartInMinutes: 2
)

Hours:

CountDownTime.hours(
  timeStartInHours: 2
)