Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extracted countdownController, disable autostart and added duration to reset method and some more #64

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## Attention

This is a fork of Circular Countdown Timer. Here i want to add some features like Reset the timer without autorun.

## Circular Countdown Timer

Make an animated circular countdown using Circular Countdown Timer.
Expand Down
21 changes: 9 additions & 12 deletions example/example.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:circular_countdown_timer/circular_countdown_timer.dart';
import 'package:circular_countdown_timer/countdown_controller.dart';

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

Expand Down Expand Up @@ -30,7 +31,12 @@ class MyHomePage extends StatefulWidget {

class _MyHomePageState extends State<MyHomePage> {
final int _duration = 10;
final CountDownController _controller = CountDownController();
final CountDownController _controller = CountDownController(
autoStart: ValueNotifier<bool>(false),
isReverse: ValueNotifier<bool>(true),
isReverseAnimation: ValueNotifier<bool>(true),
duration: const Duration(seconds: 10),
initialDuration: const Duration(seconds: 10));

@override
Widget build(BuildContext context) {
Expand All @@ -41,13 +47,12 @@ class _MyHomePageState extends State<MyHomePage> {
body: Center(
child: CircularCountDownTimer(
// Countdown duration in Seconds.
duration: _duration,

// Countdown initial elapsed Duration in Seconds.
initialDuration: 0,
initialDuration: const Duration(seconds: 10),

// Controls (i.e Start, Pause, Resume, Restart) the Countdown Timer.
controller: _controller,
countdownController: _controller,

// Width of the Countdown Widget.
width: MediaQuery.of(context).size.width / 2,
Expand Down Expand Up @@ -92,17 +97,9 @@ class _MyHomePageState extends State<MyHomePage> {
// Format for the Countdown Text.
textFormat: CountdownTextFormat.S,

// Handles Countdown Timer (true for Reverse Countdown (max to 0), false for Forward Countdown (0 to max)).
isReverse: false,

// Handles Animation Direction (true for Reverse Animation, false for Forward Animation).
isReverseAnimation: false,

// Handles visibility of the Countdown Text.
isTimerTextShown: true,

// Handles the timer start.
autoStart: false,

// This Callback will execute when the Countdown Starts.
onStart: () {
Expand Down
Loading