simple_timer_count_down 1.0.7 copy "simple_timer_count_down: ^1.0.7" to clipboard
simple_timer_count_down: ^1.0.7 copied to clipboard

Simple timer count down. Easy to use and simple to implement.

SimpleTimerCountDown #

A customizable countdown timer for Flutter apps. The SimpleTimerCountDown widget allows you to easily implement countdown functionality with flexible intervals, callbacks, and custom UI rendering.

Features #

  • Customizable Duration and Interval: Specify the total countdown time and update intervals.
  • Callbacks:
    • onStarted: Triggered when the timer starts.
    • onFinished: Triggered when the countdown ends.
    • onChange: Provides the remaining time at each interval.
  • Custom UI Rendering: Use the builder function to create a dynamic UI based on the remaining time.
  • Lifecycle Management: Automatically cleans up timers when the widget is disposed.

Installation #

Add this to your pubspec.yaml file:

dependencies:
  count_down_timer: ^<latest_version>

Then run:

flutter pub get

Usage #

Here’s a basic example of how to use SimpleTimerCountDown:

import 'package:flutter/material.dart';
import 'package:count_down_timer/count_down_timer.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(title: Text('SimpleTimerCountDown Example')),
        body: Center(
          child: SimpleTimerCountDown(
            duration: Duration(seconds: 10),
            onStarted: () => print('Timer started!'),
            onFinished: () => print('Timer finished!'),
            onChange: (time) => print('Time remaining: $time'),
            builder: (context, remainingTime) {
              return Text(
                remainingTime.inSeconds.toString(),
                style: TextStyle(fontSize: 48),
              );
            },
          ),
        ),
      ),
    );
  }
}

Properties #

Property Type Description
duration Duration The total countdown duration (required).
interval Duration The interval at which updates occur (default: 1s).
onStarted VoidCallback? Callback triggered when the timer starts.
onFinished VoidCallback? Callback triggered when the countdown ends.
onChange void Function(Duration)? Callback providing the remaining time.
builder Widget Function(BuildContext, Duration)? Custom UI builder based on the remaining time.

Example UI #

Use the builder property to create dynamic UIs:

builder: (context, remainingTime) {
  return Column(
    mainAxisAlignment: MainAxisAlignment.center,
    children: [
      Text('Time Remaining:', style: TextStyle(fontSize: 20)),
      Text(
        '${remainingTime.inSeconds}s',
        style: TextStyle(fontSize: 48, fontWeight: FontWeight.bold),
      ),
    ],
  );
},

Contributing #

Contributions are welcome! If you have ideas for new features or improvements, feel free to open an issue or submit a pull request.

License #

This project is licensed under the MIT License.

☕ Support #

Love what you see?

Buy Me A Coffee

Your support helps us keep building awesome tools like this!

Feedback #

We'd love to hear your thoughts! Feel free to create an issue on this repository if you have any suggestions or concerns.

You can also fill out this Google Form to provide feedback.

Start building with SimpleTimerCountDown today!

3
likes
160
points
55
downloads

Publisher

verified publisherhapvey.com

Weekly Downloads

Simple timer count down. Easy to use and simple to implement.

Repository (GitHub)

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on simple_timer_count_down