timer_count_down 1.0.1 copy "timer_count_down: ^1.0.1" to clipboard
timer_count_down: ^1.0.1 copied to clipboard

outdated

Simple CountDown timer. Using for create a simple timer. It's pure all

example/lib/main.dart

// Flutter libs
import 'package:flutter/material.dart';

// Other deps
import 'package:timer_count_down/timer_count_down.dart';

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

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MyHomePage(title: 'Flutter Demo CountDown'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);

  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  bool _showTimer = true;
  int _seconds = 100;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            Text(
              'Count down example',
            ),
            if (_showTimer)
              CountDown(
                seconds: _seconds,
                onTimer: () {
                  setState(() {
                    _showTimer = false;
                  });
                },
              ),
            if (!_showTimer)
              Text(
                'Timer is done!',
              ),
          ],
        ),
      ),
    );
  }
}
188
likes
0
pub points
98%
popularity

Publisher

verified publisherdizoft.ru

Simple CountDown timer. Using for create a simple timer. It's pure all

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on timer_count_down