count_down_time 0.0.8 copy "count_down_time: ^0.0.8" to clipboard
count_down_time: ^0.0.8 copied to clipboard

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:

Prop Type Description
timeId String Define the timer id.
timeStartInSeconds int Define the time to start the count-down in seconds.
textStyle (optional) textStyle Define the style of timer.
onTimeOut Function Define the callback when the count-down is finished.
onChangeTime Function(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
)
5
likes
140
pub points
76%
popularity

Publisher

unverified uploader

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

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on count_down_time