flutter_timer 0.0.6 copy "flutter_timer: ^0.0.6" to clipboard
flutter_timer: ^0.0.6 copied to clipboard

discontinued

A timer widget that shows increasing time duratioin from given initial time.

example/example.dart

import 'package:flutter/material.dart';
import 'package:flutter_timer/flutter_timer.dart';
class TimerPage extends StatefulWidget {
  @override
  _TimerPageState createState() => _TimerPageState();
}

class _TimerPageState extends State<TimerPage> {
  bool running = false;
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            TikTikTimer(
              initialDate: DateTime.now(),
              running: running,
              height: 150,
              width: 150,
              backgroundColor: Colors.indigo,
              timerTextStyle: TextStyle(color: Colors.white, fontSize: 20),
              borderRadius: 100,
              isRaised: true,
              tracetime: (time) {
                // print(time.getCurrentSecond);
              },
            ),
            Row(
              mainAxisAlignment: MainAxisAlignment.spaceAround,
              children: <Widget>[
                RaisedButton(
                  child: Text(
                    'Start',
                    style: TextStyle(color: Colors.white),
                  ),
                  color: Colors.green,
                  onPressed: () {
                    try {
                      if (running == false)
                        setState(() {
                          running = true;
                        });
                    } on Exception {}
                  },
                ),
                RaisedButton(
                  child: Text(
                    'Stop',
                    style: TextStyle(color: Colors.white),
                  ),
                  color: Colors.red,
                  onPressed: () {
                    if (running == true)
                      setState(() {
                        running = false;
                      });
                  },
                )
              ],
            )
          ],
        ),
      ),
    );
  }
}
5
likes
40
pub points
72%
popularity

Publisher

unverified uploader

A timer widget that shows increasing time duratioin from given initial time.

Repository (GitHub)
View/report issues

License

GPL-3.0 (license)

Dependencies

flutter, provider

More

Packages that depend on flutter_timer