countdown_timer_simple 1.0.2 copy "countdown_timer_simple: ^1.0.2" to clipboard
countdown_timer_simple: ^1.0.2 copied to clipboard

A flutter countdown timer component. A highly customizable countdown widget for Flutter, with support for custom styling, intervals, and onFinished callbacks.

CountdownTimer #

A simple flutter countdown timer component.

Installing #

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

dependencies:
  countdown_timer_simple: ^1.0.2

Install it

$ flutter pub get

Fields #

name description
endTime Countdown end time stamp
onEnd Countdown end event
emptyWidget The widget displayed at the end of the countdown
defaultDays String defaultDays
defaultHours String defaultHours
defaultMin String defaultMin
defaultSec final String defaultSec
daysSymbol final String daysSymbol
hoursSymbol final String hoursSymbol
minSymbol final String minSymbol
secSymbol final String secSymbol
textStyle final TextStyle textStyle
daysTextStyle final TextStyle daysTextStyle
hoursTextStyle final TextStyle hoursTextStyle
minTextStyle final TextStyle minTextStyle
secTextStyle final TextStyle secTextStyle
daysSymbolTextStyle final TextStyle daysSymbolTextStyle
hoursSymbolTextStyle final TextStyle hoursSymbolTextStyle
minSymbolTextStyle final TextStyle minSymbolTextStyle
secSymbolTextStyle final TextStyle secSymbolTextStyle
showDay final bool showDay
showHour final bool showHour
showMin final bool showMin
showSec final bool showSec

Example #

Now in your Dart code, you can use:

import 'package:countdown_timer_simple/countdown_timer_simple.dart';

  ...
  int endTime = DateTime.now().millisecondsSinceEpoch + 1000 * 60 * 60;
  ...

  CountdownTimerSimple(endTime: endTime),
  CountdownTimerSimple(endTime: endTime,
    onEnd: (){
    print("Your time is up!");
    },
  ),
  CountdownTimerSimple(
    endTime: endTime,
    textStyle: TextStyle(fontSize: 30, color: Colors.orange),
  ),
  CountdownTimerSimple(
    endTime: endTime,
    defaultDays: "==",
    defaultHours: "--",
    defaultMin: "**",
    defaultSec: "++",
    daysSymbol: "days",
    hoursSymbol: "hour ",
    minSymbol: "minute ",
    secSymbol: "sec",
    daysTextStyle: TextStyle(fontSize: 20, color: Colors.red),
    hoursTextStyle:
        TextStyle(fontSize: 30, color: Colors.orange),
    minTextStyle:
        TextStyle(fontSize: 40, color: Colors.lightBlue),
    secTextStyle: TextStyle(fontSize: 50, color: Colors.pink),
    daysSymbolTextStyle:
        TextStyle(fontSize: 25, color: Colors.green),
    hoursSymbolTextStyle:
        TextStyle(fontSize: 35, color: Colors.amberAccent),
    minSymbolTextStyle:
        TextStyle(fontSize: 45, color: Colors.black),
    secSymbolTextStyle:
        TextStyle(fontSize: 55, color: Colors.deepOrange),

onEnd => End of time trigger

example 01

CountdownTimerSimple(endTime: DateTime.now().millisecondsSinceEpoch + 1000 * 60 * 60); // timestamp

example 02: Only display hours and seconds

CountdownTimerSimple(
    endTime: DateTime.now().millisecondsSinceEpoch + 1000 * 60 * 60,
    showDay = false,
    showHour = fales,
    onEnd: () {
        print("Your time is up!");
    }    
),
3
likes
20
pub points
40%
popularity

Publisher

unverified uploader

A flutter countdown timer component. A highly customizable countdown widget for Flutter, with support for custom styling, intervals, and onFinished callbacks.

Repository (GitHub)
View/report issues

License

BSD-3-Clause (LICENSE)

Dependencies

flutter

More

Packages that depend on countdown_timer_simple