A customizable Flutter countdown widget with smooth animations and flexible formatting. Display time in DD:HH:MM:SS
format with control over styles, visibility, and callbacks — perfect for limited-time offers, product launches, sales, and other time-sensitive events.
- Countdown from any
Duration
- Custom text styles for digits and separators
- Show or hide days, hours, minutes, and seconds
- Animated number transitions
- Callback triggered when countdown ends
- Optional custom separator widget
Add the following line to your pubspec.yaml
file:
dependencies:
easy_countdown_timer: ^0.0.4
Then run:
flutter pub get
Usage
Import the package:
import 'package:easy_countdown_timer/easy_countdown_timer_widget.dart';
Use the widget:
EasyCountdownTimerWidget(
duration: Duration(days: 1, hours: 5, minutes: 30),
digitTextStyle: TextStyle(fontSize: 28, fontWeight: FontWeight.bold),
separatorTextStyle: TextStyle(fontSize: 28, color: Colors.grey),
onFinished: () => print('Countdown Complete!'),
showDays: true,
showHours: true,
showMinutes: true,
showSeconds: true,
separatedWidget: Text(" : ", style: TextStyle(color: Colors.blue)),
)
Parameters
| Parameter | Type | Default | Description |
|-----------------------|----------------|-----------|----------------------------------|
| duration | Duration | — | Countdown duration |
| digitTextStyle | TextStyle? | null | Style for digit text |
| separatorTextStyle | TextStyle? | null | Style for the default separator |
| onFinished | VoidCallback? | null | Called when the countdown ends |
| showDays | bool | true | Show the day part |
| showHours | bool | true | Show the hour part |
| showMinutes | bool | true | Show the minute part |
| showSeconds | bool | true | Show the second part |
| separatedWidget | Widget? | : | Custom separator widget |
Example
To try the package locally, clone the repository and run the example:
git clone https://github.com/houssemeddinefadhli81/easy-countdown-timer.git
cd easy-countdown-timer/example
flutter run
Screenshots
This project is licensed under the MIT License. See the LICENSE file for details.
Contributions are welcome. Please open issues or submit pull requests to help improve this package.
If you find this package useful, consider giving it a star on GitHub or pub.dev.