Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/taixw2/flutter_countdown
An easy way to use count down
https://github.com/taixw2/flutter_countdown
Last synced: 5 days ago
JSON representation
An easy way to use count down
- Host: GitHub
- URL: https://github.com/taixw2/flutter_countdown
- Owner: taixw2
- License: mit
- Created: 2018-11-16T01:38:19.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2020-02-19T03:58:49.000Z (over 4 years ago)
- Last Synced: 2024-05-28T22:15:59.076Z (6 months ago)
- Language: Dart
- Size: 166 KB
- Stars: 7
- Watchers: 2
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# flutter_countdown
An easy way to use count down
## How to use flutter_countdown
1. Open the `pubspec.yaml` file, and add `flutter_countdown: ` unde `dependencies`:
```
dependencies:
flutter:
sdk: flutter
# ...
# ...
flutter_countdown: ^0.1.3
```2. install it from terminal: Run `flutter packages get`
## Example
![example](./show.gif)
``` dart
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);
}
),
)),
);
}
}
```### link
[stackoverflow](https://stackoverflow.com/questions/44302588/flutter-create-a-countdown-widget#answer-44309043)