-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added 10s progress bar of get ready to next stage
- Loading branch information
Showing
14 changed files
with
225 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
export 'package:infinite_horizons/presentation/atoms/button_atom.dart'; | ||
export 'package:infinite_horizons/presentation/atoms/check_box_atom.dart'; | ||
export 'package:infinite_horizons/presentation/atoms/list_tile_atom.dart'; | ||
export 'package:infinite_horizons/presentation/atoms/progress_indicator_atom.dart'; | ||
export 'package:infinite_horizons/presentation/atoms/separator_atom.dart'; | ||
export 'package:infinite_horizons/presentation/atoms/text_atom.dart'; | ||
export 'package:infinite_horizons/presentation/atoms/timer_atom.dart'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
class ProgressIndicatorAtom extends StatefulWidget { | ||
const ProgressIndicatorAtom(this.totalDuration, this.callback); | ||
|
||
/// In Seconds | ||
final Duration totalDuration; | ||
final VoidCallback callback; | ||
|
||
@override | ||
State<ProgressIndicatorAtom> createState() => _ProgressIndicatorAtomState(); | ||
} | ||
|
||
class _ProgressIndicatorAtomState extends State<ProgressIndicatorAtom> | ||
with TickerProviderStateMixin { | ||
late AnimationController controller; | ||
|
||
@override | ||
void initState() { | ||
updateProgress(); | ||
super.initState(); | ||
} | ||
|
||
void updateProgress() { | ||
controller = AnimationController( | ||
vsync: this, | ||
duration: widget.totalDuration, | ||
); | ||
controller.addListener(() { | ||
setState(() {}); | ||
}); | ||
controller.addStatusListener((status) { | ||
if (status == AnimationStatus.completed) { | ||
widget.callback(); | ||
} | ||
}); | ||
controller.forward(); | ||
} | ||
|
||
@override | ||
void dispose() { | ||
controller.dispose(); | ||
super.dispose(); | ||
} | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return LinearProgressIndicator( | ||
value: controller.value, | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export 'package:infinite_horizons/presentation/organisms/intro/motivation_organism.dart'; | ||
export 'package:infinite_horizons/presentation/organisms/intro/tips_organism.dart'; | ||
export 'package:infinite_horizons/presentation/organisms/intro/welcome_organism.dart'; | ||
export 'package:infinite_horizons/presentation/organisms/timer_molecule.dart'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import 'package:circular_countdown_timer/circular_countdown_timer.dart'; | ||
import 'package:flutter/cupertino.dart'; | ||
import 'package:infinite_horizons/presentation/atoms/atoms.dart'; | ||
|
||
class TimerMolecule extends StatelessWidget { | ||
TimerMolecule(this.onComplete, this.duration); | ||
|
||
final Duration duration; | ||
final VoidCallback onComplete; | ||
|
||
final CountDownController controller = CountDownController(); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Expanded( | ||
child: Column( | ||
mainAxisAlignment: MainAxisAlignment.center, | ||
children: [ | ||
Center( | ||
child: TimerAtom( | ||
controller, | ||
duration, | ||
onComplete, | ||
), | ||
), | ||
const SeparatorAtom(), | ||
Row( | ||
mainAxisAlignment: MainAxisAlignment.spaceEvenly, | ||
children: [ | ||
ButtonAtom( | ||
variant: ButtonVariant.primary, | ||
onPressed: controller.resume, | ||
text: 'Continue', | ||
), | ||
ButtonAtom( | ||
variant: ButtonVariant.secondary, | ||
onPressed: controller.pause, | ||
text: 'Pause', | ||
), | ||
], | ||
), | ||
], | ||
), | ||
); | ||
} | ||
} |
Oops, something went wrong.