timercounter 0.0.5 copy "timercounter: ^0.0.5" to clipboard
timercounter: ^0.0.5 copied to clipboard

outdated

倒计时工具.

timercounter #

倒计时工具.

Getting Started #

This project is a starting point for a Dart package, a library module containing code that can be shared easily across multiple Flutter or Dart projects.

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

Usage #

It is really easy to use! You should ensure that you add the timercounter as a dependency in your flutter project.

dependencies:
  timercounter: ^0.0.4

class Home extends StatefulWidget {
  @override
  _HomeState createState() => _HomeState();
}

class _HomeState extends State<Home> {
  TimerCounter _timeCounter;
  int counter = 59;

  @override
  void dispose() {
    _timeCounter.stop();
    super.dispose();
  }

  void _beginTimer() {
    _timeCounter = TimerCounter.begin(duration: 60, callback: (index){
      setState(() {
        counter = index;
      });
    });
  }
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Column(
        children: [
          Text("$counter"),
          RaisedButton(
            onPressed: _beginTimer,
          )
        ],
      ),
    );
  }
}

1
likes
0
pub points
23%
popularity

Publisher

unverified uploader

倒计时工具.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on timercounter