flutter_countdown 0.1.4

flutter_countdown #

An easy way to use count down

How to use flutter_countdown #

  1. Open the pubspec.yaml file, and add flutter_countdown: <latest_version> unde dependencies:
  dependencies:
    flutter:
      sdk: flutter
    # ...
    # ...
    flutter_countdown: ^0.1.3
  1. install it from terminal: Run flutter packages get

Example #

example

import "package:flutter/material.dart";
import 'package:flutter_countdown/countdown.dart';

void main() {
  runApp(Example());
}

class Example extends StatelessWidget {
  final int beginCount = 5;
  
  @override
  Widget build(BuildContext context) {
    return new Scaffold(
      body: new Card(
          child: new Center(
        child: CountDown(
          renderSemanticLabel: (count) {
            if (count == beginCount) {
              return "点击获取验证码";
            }
            return "$count 秒后重试";
          },
          beginCount: beginCount,
          endCount: 0,
          onPress: (ctr) {
            if (ctr.isAnimating) {
              return  Future.value(false);
            }
            return Future.value(true);
          }
        ),
      )),
    );
  }
}

stackoverflow

[0.1.0] - 2018-11-16 09:44:18

  • initial release.

[0.1.1] - 2018-11-16 10:37:25

  • remove button padding

[0.1.3] - 2018-11-16 10:37:25

  • Increase package's point

[0.1.4] - 2018-11-16 10:37:25

  • renderSemanticLabel => renderLabel
  • renderSemanticLabel is deprecated and shouldn't be used.

example/main.dart

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

void main() {
  runApp(Example());
}

Use this package as a library

1. Depend on it

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


dependencies:
  flutter_countdown: ^0.1.4

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:flutter_countdown/flutter_countdown.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
69
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]
84
Learn more about scoring.

We analyzed this package on Aug 16, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.4.0
  • pana: 0.12.19
  • Flutter: 1.7.8+hotfix.4

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health suggestions

Fix lib/flutter_countdown.dart. (-0.50 points)

Analysis of lib/flutter_countdown.dart reported 1 hint:

line 34 col 9: The class 'Future' was not exported from 'dart:core' until version 2.1, but this code is required to be able to run on earlier versions.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.68.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.6 1.1.7
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test