Change default durations

This commit is contained in:
Digital Studium 2023-10-08 14:22:13 +03:00
parent ccae077e14
commit b904fef3f5
3 changed files with 16 additions and 16 deletions

View File

@ -26,6 +26,6 @@ subprojects {
project.evaluationDependsOn(':app') project.evaluationDependsOn(':app')
} }
task clean(type: Delete) { tasks.register("clean", Delete) {
delete rootProject.buildDir delete rootProject.buildDir
} }

View File

@ -13,7 +13,7 @@ class KriyaPage extends StatefulWidget {
} }
class _KriyaPageState extends State<KriyaPage> { class _KriyaPageState extends State<KriyaPage> {
Duration kriyaDuration = const Duration(minutes: 1); Duration kriyaDuration = const Duration(seconds: 30);
Duration shavasanaDuration = const Duration(minutes: 7); Duration shavasanaDuration = const Duration(minutes: 7);
late int exNumber = 38; late int exNumber = 38;
late int totalDuration = late int totalDuration =

View File

@ -13,11 +13,11 @@ class UniversalPage extends StatefulWidget {
} }
class _UniversalPageState extends State<UniversalPage> { class _UniversalPageState extends State<UniversalPage> {
Duration universalDuration = const Duration(minutes: 10); Duration exerciseDuration = const Duration(minutes: 4);
Duration shavasanaDuration = const Duration(minutes: 5); Duration shavasanaDuration = const Duration(minutes: 10);
late int exNumber = 3; late int exNumber = 5;
late int totalDuration = late int totalDuration =
universalDuration.inSeconds * exNumber + shavasanaDuration.inSeconds; exerciseDuration.inSeconds * exNumber + shavasanaDuration.inSeconds;
late Timer _timer; late Timer _timer;
late String startText = 'Старт'; late String startText = 'Старт';
@ -25,7 +25,7 @@ class _UniversalPageState extends State<UniversalPage> {
bool isStarted() { bool isStarted() {
if (totalDuration == if (totalDuration ==
universalDuration.inSeconds * exNumber + shavasanaDuration.inSeconds) { exerciseDuration.inSeconds * exNumber + shavasanaDuration.inSeconds) {
return false; return false;
} }
return true; return true;
@ -54,7 +54,7 @@ class _UniversalPageState extends State<UniversalPage> {
totalDuration--; totalDuration--;
}); });
} else if ((totalDuration - shavasanaDuration.inSeconds) % } else if ((totalDuration - shavasanaDuration.inSeconds) %
universalDuration.inSeconds == exerciseDuration.inSeconds ==
0 && 0 &&
(totalDuration - shavasanaDuration.inSeconds) > 0) { (totalDuration - shavasanaDuration.inSeconds) > 0) {
player.play(AssetSource('audio/start.mp3')); player.play(AssetSource('audio/start.mp3'));
@ -78,7 +78,7 @@ class _UniversalPageState extends State<UniversalPage> {
_timer.cancel(); _timer.cancel();
startText = 'Старт'; startText = 'Старт';
totalDuration = totalDuration =
universalDuration.inSeconds * exNumber + shavasanaDuration.inSeconds; exerciseDuration.inSeconds * exNumber + shavasanaDuration.inSeconds;
}); });
} }
@ -86,7 +86,7 @@ class _UniversalPageState extends State<UniversalPage> {
setState(() { setState(() {
exNumber = value!; exNumber = value!;
totalDuration = totalDuration =
universalDuration.inSeconds * exNumber + shavasanaDuration.inSeconds; exerciseDuration.inSeconds * exNumber + shavasanaDuration.inSeconds;
}); });
} }
@ -198,21 +198,21 @@ class _UniversalPageState extends State<UniversalPage> {
: () => _showDialog( : () => _showDialog(
CupertinoTimerPicker( CupertinoTimerPicker(
mode: CupertinoTimerPickerMode.ms, mode: CupertinoTimerPickerMode.ms,
initialTimerDuration: universalDuration, initialTimerDuration: exerciseDuration,
onTimerDurationChanged: (Duration newDuration) { onTimerDurationChanged: (Duration newDuration) {
setState(() { setState(() {
universalDuration = newDuration; exerciseDuration = newDuration;
totalDuration = totalDuration =
universalDuration.inSeconds * exNumber + exerciseDuration.inSeconds * exNumber +
shavasanaDuration.inSeconds; shavasanaDuration.inSeconds;
}); });
}, },
), ),
), ),
child: Text( child: Text(
format(universalDuration)[1] + format(exerciseDuration)[1] +
":" + ":" +
format(universalDuration)[2], format(exerciseDuration)[2],
style: const TextStyle( style: const TextStyle(
fontSize: 22.0, fontSize: 22.0,
), ),
@ -235,7 +235,7 @@ class _UniversalPageState extends State<UniversalPage> {
setState(() { setState(() {
shavasanaDuration = newDuration; shavasanaDuration = newDuration;
totalDuration = totalDuration =
universalDuration.inSeconds * exNumber + exerciseDuration.inSeconds * exNumber +
shavasanaDuration.inSeconds; shavasanaDuration.inSeconds;
}); });
}, },