countdown_flutter 0.0.2 countdown_flutter: ^0.0.2 copied to clipboard
A simple countdown plugin for flutter.
countdown #
A simple countdown plugin for flutter
Getting Started #
This project is a starting point for a Flutter plug-in package, a specialized package that includes platform-specific implementation code for Android and/or iOS.
For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.
Usage #
import 'package:flutter/material.dart';
import 'package:countdown_flutter/countdown_flutter.dart';
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
var _done = false;
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: Text(_done ? 'Finished!' : 'Counting...'),
),
body: Center(
child: Countdown(
duration: Duration(seconds: 10),
onFinish: () {
setState(() {
_done = true;
});
},
builder: (BuildContext ctx, Duration remaining) => Text(
'${remaining.inMinutes}:${remaining.inSeconds}',
style: TextStyle(
fontSize: 30,
),
),
),
),
),
);
}
}