Giter VIP home page Giter VIP logo

flutter-countdown's Introduction

flutter-countdown

A simple countdown plugin for flutter ⌛

gif

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

Countdown

import 'package:flutter/material.dart';
import 'package:countdown_flutter/countdown_flutter.dart';

class Foo extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Center(
      child: Countdown(
        duration: Duration(seconds: 10),
        onFinish: () {
          print('finished!');
        },
        builder: (BuildContext ctx, Duration remaining) {
            return Text('${remaining.inMinutes}:${remaining.inSeconds}');
        },
      ),
    );
  }
}

CountdownFormatted

import 'package:flutter/material.dart';
import 'package:countdown_flutter/countdown_flutter.dart';

class Foo extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Center(
      child: CountdownFormatted(
        duration: Duration(hours: 1),
        builder: (BuildContext ctx, String remaining) {
          return Text(remaining); // 01:00:00
        },
      ),
    );
  }
}

flutter-countdown's People

Contributors

leocardoso94 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

flutter-countdown's Issues

Start and stop method ?

Is your feature request related to a problem? Please describe.
I want to be able to start and stop the countdown

Describe the solution you'd like
Have a start and a stop method available

Deprecated version of the Android embedding

Describe the bug
The plugin countdown_flutter uses a deprecated version of the Android embedding.
To avoid unexpected runtime failures or future build failures, try to see if this plugin supports the Android V2 embedding. Otherwise, consider removing it since a future release of Flutter will remove these deprecated APIs.
If you are the plugin author, take a look at the docs for migrating the plugin to the V2 embedding: https://flutter.dev/go/android-plugin-migration.

To Reproduce
Steps to reproduce the behavior:

  1. Add the plugin to pubspec.yaml
  2. Run flutter pub get
  3. See error

Expected behavior
Should run pub get without warning.

Screenshots
bidcars – pubspec yaml 9_15_2021 8_05_46 PM

Additional context
If you are the plugin author, take a look at the docs for migrating the plugin to the V2 embedding: https://flutter.dev/go/android-plugin-migration.

Podspec file needs to be renamed

When attempting to use on iOS, I got No podspec found for...
I was able to fix the issue in my local project by renaming .symlinks/plugins/countdown_flutter/ios/countdown.podspec to .symlinks/plugins/countdown_flutter/ios/countdown_flutter.podspec and modifying the s.name in that file to be countdown_flutter.

I'm guessing it probably broke on this commit: b599a27

Let me know if you'd like me to open a PR, but this is probably a quick fix for you.

Thanks for sharing your code!

Timer Restart on App Restart

I am creating a intermittent fasting app that shows how much hours the user has fasted. When the user clicks the "Start fasting" button the timer duration is set to 8 hours and started.

When the user exits, uses some other apps and reopen this app again, the timer starts from the beginning. Is there a way to run the timer in background.

Build warnings

Warning 1

Please remove usages of `jcenter()` Maven repository from your build scripts and migrate your build to other Maven repositories.
This repository is deprecated and it will be shut down in the future.
See http://developer.android.com/r/tools/jcenter-end-of-service for more information.
Currently detected usages in: root project 'android', project ':app', project ':countdown_flutter', ...
Affected Modules: app

Warning 2

Using flatDirs should be avoided because it doesn't support any meta-data formats.
Currently detected usages:
- repository flatDir used in: root project 'android', project ':app', project ':countdown_flutter', ...
Affected Modules: app

To Reproduce
Steps to reproduce the behavior:

  1. Build with Android Studio 4.2 and see warning in logs

Expected behavior
This warning should not be shown.

CountDownFormatted not keeping the format

If you set the duration to, let's say 5 minutes, the CountDownFormatted shows 00:5:00 (missing a zero).
Also, if I set to one hour it shows 1:00:00 but as soon as there's less than one hour the hours "display" disappear showing only the minutes and seconds like 59:59.
Would be nice to set the format type we want and keep it on the timer.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.