circular_countdown 1.0.2

  • Readme
  • Changelog
  • Example
  • Installing
  • 87

circular_countdown #

A package that represents a circular countdown that you can use for every kind of units (days, hours, seconds, points, ...) that could be decremented.

Getting Started #

In the pubspec.yaml of your flutter project, add the following dependency:

dependencies:
  ...
  circular_countdown: ^1.0.2

In your library add the following import:

import  'package:circular_countdown/circular_countdown.dart';

Static countdown #

This is the way to create a simple static countdown.

import 'package:flutter/material.dart';
...
CircularCountdown(
	countdownTotal:  10,
	countdownRemaining:  7,
)
...

By playing with the parameters, you can change the size, the colors, the size of the gaps, the strokeWidth and more to have more complex Countdowns.

Timer countdown #

If you want to use the CircularCountdown widget as a Time Countdown, you can use the built-in TimeCircularCountdown that wraps the timer logic for you: (see how in example)

TimeCircularCountdown(
    unit: CountdownUnit.seconds,
    countdownTotal: 30,
    onUpdated: (unit, remainingTime) => print('Updated'),
    onFinished: () => print('Countdown finished'),
);

Demo #

A web demo is available here : https://mattisbrizard.github.io/circular_countdown/#/

Build Status

Contribution #

If you find a bug or want a feature, but don't know how to fix/implement it, please fill an issue. If you fixed a bug or implemented a feature, please send a pull request.

[1.0.2] - 28/06/2020 #

Changes : #

  • Added timer gif in Readme.

[1.0.1] - 14/05/2020 #

Changes : #

  • Updated Documentation.

[1.0.0] - 10/05/2020 #

Added : #

Added a TimeCircularCountdown which provides an easy way to setup a time countdown with the CircularCountdown.

TimeCircularCountdown(
    unit: CountdownUnit.minute,
    countdownTotal: 5,
    onUpdated: (unit, remainingTime) => print('Updated'),
    onFinished: () => print('Countdown finished'),
    onCanceled: (unit, remainingTime) => print('Canceled'),
    textStyle: const TextStyle(
        color: Colors.white,
        fontSize: 90,
    ),
);

Breaking changes : #

Updated CircularCountdown constructor :

  • textSpan has been replaced by textSyle that will be used to display the current value of the countdown.

Changes : #

  • Updated CircularCountdown constructor :

    • diameter is no longer required. (If not provided then should take either the maximum space if possible or 100)
    • countdownRemaining is no longer required.
  • Updated README.md

[0.1.0] - 15/08/2019 #

Added possibility to display a textSpan in the center of the widget.

This textSpan will displays only if there is enough space.

CircularCountdown(
    diameter: 250,
    countdownTotal: 10,
    countdownRemaining: 7,
    strokeWidth: 45,
    textSpan: TextSpan(
        text: '7',
        style: TextStyle(
            color: Colors.white,
            fontSize: 90,
        ),
    ),
)

[0.0.2] - 02/08/2019 #

Updated doc

[0.0.1] - 02/08/2019 #

Initial release

example/lib/main.dart

import 'package:flutter/material.dart';

import 'countdowns/static_countdown.dart';
import 'countdowns/time_countdown.dart';

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

class MyApp extends StatelessWidget {
  const MyApp({
    Key key,
  }) : super(key: key);
  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      title: 'Circular Countdown',
      home: MyHomePage(),
      debugShowCheckedModeBanner: false,
    );
  }
}

class MyHomePage extends StatelessWidget {
  const MyHomePage({
    Key key,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('CircularCountdown Example'),
        backgroundColor: Colors.transparent,
        elevation: 0,
      ),
      backgroundColor: Colors.grey[900],
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            RaisedButton(
              onPressed: () => Navigator.of(context).push(
                MaterialPageRoute<StaticCountdownPage>(
                  builder: (context) => const StaticCountdownPage(),
                ),
              ),
              child: const Text('Static CircularCountdown'),
            ),
            RaisedButton(
              onPressed: () => Navigator.of(context).push(
                MaterialPageRoute<TimeCountdownPage>(
                  builder: (context) => const TimeCountdownPage(),
                ),
              ),
              child: const Text('Time CircularCountdown'),
            ),
          ],
        ),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  circular_countdown: ^1.0.2

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:circular_countdown/circular_countdown.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
74
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
87
Learn more about scoring.

We analyzed this package on Jul 2, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.13
  • Flutter: 1.17.5

Analysis suggestions

Package not compatible with SDK dart

because of import path [circular_countdown] that is in a package requiring null.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.12 1.14.13
meta 1.1.8
sky_engine 0.0.99
typed_data 1.1.6 1.2.0
vector_math 2.0.8
Dev dependencies
flutter_test