Skip to content

Offline gym log for Android. No account, no ads, no internet.

Add rest days to the rotation

InlitX1346ab18a9dc
diff --git a/lib/l10n/app_ar.arb b/lib/l10n/app_ar.arb
index 7b0cda0..a1b1fc7 100644
--- a/lib/l10n/app_ar.arb
+++ b/lib/l10n/app_ar.arb
@@ -1406,5 +1406,11 @@
"autoBackupNever": "لا توجد نسخ بعد",
"autoBackupLost": "تعذّر حفظ آخر نسخة. اختر المجلد مرة أخرى.",
"autoBackupSaved": "تم حفظ النسخة",
- "prepPortions": "حصص"
+ "prepPortions": "حصص",
+ "rotationAddRest": "أضف يوم راحة",
+ "rotationRestHint": "ينتقل تلقائيًا في اليوم التالي",
+ "rotationRestToday": "اليوم",
+ "rotationSkipRest": "تخطَّ يوم الراحة هذا",
+ "rotationRestUpNext": "التالي: {name}",
+ "trainAnyway": "تمرّن على أي حال"
}
diff --git a/lib/l10n/app_de.arb b/lib/l10n/app_de.arb
index 242c306..6af7557 100644
--- a/lib/l10n/app_de.arb
+++ b/lib/l10n/app_de.arb
@@ -1406,5 +1406,11 @@
"autoBackupNever": "Noch keine Sicherung",
"autoBackupLost": "Die letzte Sicherung ging nicht. Wähle den Ordner erneut.",
"autoBackupSaved": "Sicherung gespeichert",
- "prepPortions": "Portionen"
+ "prepPortions": "Portionen",
+ "rotationAddRest": "Ruhetag hinzufügen",
+ "rotationRestHint": "Geht am nächsten Tag von selbst weiter",
+ "rotationRestToday": "Heute",
+ "rotationSkipRest": "Diesen Ruhetag überspringen",
+ "rotationRestUpNext": "Danach: {name}",
+ "trainAnyway": "Trotzdem trainieren"
}
diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb
index 888320a..1622ad9 100644
--- a/lib/l10n/app_en.arb
+++ b/lib/l10n/app_en.arb
@@ -1792,5 +1792,12 @@
"autoBackupNever": "No backup yet",
"autoBackupLost": "Couldn't save the last backup. Choose the folder again.",
"autoBackupSaved": "Backup saved",
- "prepPortions": "Portions"
+ "prepPortions": "Portions",
+ "rotationAddRest": "Add a rest day",
+ "rotationRestHint": "Moves on by itself the next day",
+ "rotationRestToday": "Today",
+ "rotationSkipRest": "Skip this rest day",
+ "rotationRestUpNext": "Next: {name}",
+ "@rotationRestUpNext": {"placeholders": {"name": {"type": "String"}}},
+ "trainAnyway": "Train anyway"
}
diff --git a/lib/l10n/app_es.arb b/lib/l10n/app_es.arb
index bc3f7f7..6b9af7d 100644
--- a/lib/l10n/app_es.arb
+++ b/lib/l10n/app_es.arb
@@ -1527,5 +1527,11 @@
"autoBackupNever": "Aún no hay copias",
"autoBackupLost": "No se pudo guardar la última copia. Vuelve a elegir la carpeta.",
"autoBackupSaved": "Copia guardada",
- "prepPortions": "Raciones"
+ "prepPortions": "Raciones",
+ "rotationAddRest": "Añadir día de descanso",
+ "rotationRestHint": "Pasa solo al día siguiente",
+ "rotationRestToday": "Hoy",
+ "rotationSkipRest": "Saltar este descanso",
+ "rotationRestUpNext": "Después: {name}",
+ "trainAnyway": "Entrenar igualmente"
}
diff --git a/lib/l10n/app_fa.arb b/lib/l10n/app_fa.arb
index c58ee78..50c9ef9 100644
--- a/lib/l10n/app_fa.arb
+++ b/lib/l10n/app_fa.arb
@@ -1406,5 +1406,11 @@
"autoBackupNever": "هنوز پشتیبانی نیست",
"autoBackupLost": "ذخیره آخرین پشتیبان ممکن نشد. دوباره پوشه را انتخاب کن.",
"autoBackupSaved": "پشتیبان ذخیره شد",
- "prepPortions": "وعده‌ها"
+ "prepPortions": "وعده‌ها",
+ "rotationAddRest": "افزودن روز استراحت",
+ "rotationRestHint": "روز بعد خودش رد می‌شود",
+ "rotationRestToday": "امروز",
+ "rotationSkipRest": "رد کردن این استراحت",
+ "rotationRestUpNext": "بعدی: {name}",
+ "trainAnyway": "به هر حال تمرین کن"
}
diff --git a/lib/l10n/app_fr.arb b/lib/l10n/app_fr.arb
index c76ca83..d99e6f9 100644
--- a/lib/l10n/app_fr.arb
+++ b/lib/l10n/app_fr.arb
@@ -1406,5 +1406,11 @@
"autoBackupNever": "Aucune sauvegarde",
"autoBackupLost": "La dernière sauvegarde a échoué. Choisis à nouveau le dossier.",
"autoBackupSaved": "Sauvegarde enregistrée",
- "prepPortions": "Portions"
+ "prepPortions": "Portions",
+ "rotationAddRest": "Ajouter un jour de repos",
+ "rotationRestHint": "Passe toute seule le lendemain",
+ "rotationRestToday": "Aujourd’hui",
+ "rotationSkipRest": "Sauter ce jour de repos",
+ "rotationRestUpNext": "Ensuite : {name}",
+ "trainAnyway": "M’entraîner quand même"
}
diff --git a/lib/l10n/app_it.arb b/lib/l10n/app_it.arb
index 98ade6e..4be8482 100644
--- a/lib/l10n/app_it.arb
+++ b/lib/l10n/app_it.arb
@@ -1406,5 +1406,11 @@
"autoBackupNever": "Ancora nessun backup",
"autoBackupLost": "Non è stato possibile salvare l'ultimo backup. Scegli di nuovo la cartella.",
"autoBackupSaved": "Backup salvato",
- "prepPortions": "Porzioni"
+ "prepPortions": "Porzioni",
+ "rotationAddRest": "Aggiungi un giorno di riposo",
+ "rotationRestHint": "Passa da sola il giorno dopo",
+ "rotationRestToday": "Oggi",
+ "rotationSkipRest": "Salta questo riposo",
+ "rotationRestUpNext": "Poi: {name}",
+ "trainAnyway": "Allenati lo stesso"
}
diff --git a/lib/l10n/app_ja.arb b/lib/l10n/app_ja.arb
index 2d7d7f3..4eeb5cf 100644
--- a/lib/l10n/app_ja.arb
+++ b/lib/l10n/app_ja.arb
@@ -1406,5 +1406,11 @@
"autoBackupNever": "まだバックアップはありません",
"autoBackupLost": "前回のバックアップを保存できませんでした。フォルダを選び直してください。",
"autoBackupSaved": "バックアップを保存しました",
- "prepPortions": "等分"
+ "prepPortions": "等分",
+ "rotationAddRest": "休息日を追加",
+ "rotationRestHint": "翌日に自動で進みます",
+ "rotationRestToday": "今日",
+ "rotationSkipRest": "この休息日をスキップ",
+ "rotationRestUpNext": "次:{name}",
+ "trainAnyway": "それでもトレーニング"
}
diff --git a/lib/l10n/app_ko.arb b/lib/l10n/app_ko.arb
index 10fc65b..b4279a7 100644
--- a/lib/l10n/app_ko.arb
+++ b/lib/l10n/app_ko.arb
@@ -1406,5 +1406,11 @@
"autoBackupNever": "아직 백업이 없어요",
"autoBackupLost": "마지막 백업을 저장하지 못했어요. 폴더를 다시 선택하세요.",
"autoBackupSaved": "백업을 저장했어요",
- "prepPortions": "나누기"
+ "prepPortions": "나누기",
+ "rotationAddRest": "휴식일 추가",
+ "rotationRestHint": "다음 날 자동으로 넘어가요",
+ "rotationRestToday": "오늘",
+ "rotationSkipRest": "이 휴식일 건너뛰기",
+ "rotationRestUpNext": "다음: {name}",
+ "trainAnyway": "그래도 운동하기"
}
diff --git a/lib/l10n/app_localizations.dart b/lib/l10n/app_localizations.dart
index 07083a7..289a2e7 100644
--- a/lib/l10n/app_localizations.dart
+++ b/lib/l10n/app_localizations.dart
@@ -9291,6 +9291,42 @@ abstract class AppLocalizations {
/// In en, this message translates to:
/// **'Portions'**
String get prepPortions;
+
+ /// No description provided for @rotationAddRest.
+ ///
+ /// In en, this message translates to:
+ /// **'Add a rest day'**
+ String get rotationAddRest;
+
+ /// No description provided for @rotationRestHint.
+ ///
+ /// In en, this message translates to:
+ /// **'Moves on by itself the next day'**
+ String get rotationRestHint;
+
+ /// No description provided for @rotationRestToday.
+ ///
+ /// In en, this message translates to:
+ /// **'Today'**
+ String get rotationRestToday;
+
+ /// No description provided for @rotationSkipRest.
+ ///
+ /// In en, this message translates to:
+ /// **'Skip this rest day'**
+ String get rotationSkipRest;
+
+ /// No description provided for @rotationRestUpNext.
+ ///
+ /// In en, this message translates to:
+ /// **'Next: {name}'**
+ String rotationRestUpNext(String name);
+
+ /// No description provided for @trainAnyway.
+ ///
+ /// In en, this message translates to:
+ /// **'Train anyway'**
+ String get trainAnyway;
}
class _AppLocalizationsDelegate extends LocalizationsDelegate<AppLocalizations> {
diff --git a/lib/l10n/app_localizations_ar.dart b/lib/l10n/app_localizations_ar.dart
index 22bd115..78cc74a 100644
--- a/lib/l10n/app_localizations_ar.dart
+++ b/lib/l10n/app_localizations_ar.dart
@@ -5256,4 +5256,24 @@ class AppLocalizationsAr extends AppLocalizations {
@override
String get prepPortions => 'حصص';
+
+ @override
+ String get rotationAddRest => 'أضف يوم راحة';
+
+ @override
+ String get rotationRestHint => 'ينتقل تلقائيًا في اليوم التالي';
+
+ @override
+ String get rotationRestToday => 'اليوم';
+
+ @override
+ String get rotationSkipRest => 'تخطَّ يوم الراحة هذا';
+
+ @override
+ String rotationRestUpNext(String name) {
+ return 'التالي: $name';
+ }
+
+ @override
+ String get trainAnyway => 'تمرّن على أي حال';
}
diff --git a/lib/l10n/app_localizations_de.dart b/lib/l10n/app_localizations_de.dart
index d863159..f3681ef 100644
--- a/lib/l10n/app_localizations_de.dart
+++ b/lib/l10n/app_localizations_de.dart
@@ -5281,4 +5281,24 @@ class AppLocalizationsDe extends AppLocalizations {
@override
String get prepPortions => 'Portionen';
+
+ @override
+ String get rotationAddRest => 'Ruhetag hinzufügen';
+
+ @override
+ String get rotationRestHint => 'Geht am nächsten Tag von selbst weiter';
+
+ @override
+ String get rotationRestToday => 'Heute';
+
+ @override
+ String get rotationSkipRest => 'Diesen Ruhetag überspringen';
+
+ @override
+ String rotationRestUpNext(String name) {
+ return 'Danach: $name';
+ }
+
+ @override
+ String get trainAnyway => 'Trotzdem trainieren';
}
diff --git a/lib/l10n/app_localizations_en.dart b/lib/l10n/app_localizations_en.dart
index 53ce903..9173cae 100644
--- a/lib/l10n/app_localizations_en.dart
+++ b/lib/l10n/app_localizations_en.dart
@@ -5234,4 +5234,24 @@ class AppLocalizationsEn extends AppLocalizations {
@override
String get prepPortions => 'Portions';
+
+ @override
+ String get rotationAddRest => 'Add a rest day';
+
+ @override
+ String get rotationRestHint => 'Moves on by itself the next day';
+
+ @override
+ String get rotationRestToday => 'Today';
+
+ @override
+ String get rotationSkipRest => 'Skip this rest day';
+
+ @override
+ String rotationRestUpNext(String name) {
+ return 'Next: $name';
+ }
+
+ @override
+ String get trainAnyway => 'Train anyway';
}
diff --git a/lib/l10n/app_localizations_es.dart b/lib/l10n/app_localizations_es.dart
index 3cc47de..0d93cb9 100644
--- a/lib/l10n/app_localizations_es.dart
+++ b/lib/l10n/app_localizations_es.dart
@@ -5274,4 +5274,24 @@ class AppLocalizationsEs extends AppLocalizations {
@override
String get prepPortions => 'Raciones';
+
+ @override
+ String get rotationAddRest => 'Añadir día de descanso';
+
+ @override
+ String get rotationRestHint => 'Pasa solo al día siguiente';
+
+ @override
+ String get rotationRestToday => 'Hoy';
+
+ @override
+ String get rotationSkipRest => 'Saltar este descanso';
+
+ @override
+ String rotationRestUpNext(String name) {
+ return 'Después: $name';
+ }
+
+ @override
+ String get trainAnyway => 'Entrenar igualmente';
}
diff --git a/lib/l10n/app_localizations_fa.dart b/lib/l10n/app_localizations_fa.dart
index a07f9af..dff1d0c 100644
--- a/lib/l10n/app_localizations_fa.dart
+++ b/lib/l10n/app_localizations_fa.dart
@@ -5227,4 +5227,24 @@ class AppLocalizationsFa extends AppLocalizations {
@override
String get prepPortions => 'وعده‌ها';
+
+ @override
+ String get rotationAddRest => 'افزودن روز استراحت';
+
+ @override
+ String get rotationRestHint => 'روز بعد خودش رد می‌شود';
+
+ @override
+ String get rotationRestToday => 'امروز';
+
+ @override
+ String get rotationSkipRest => 'رد کردن این استراحت';
+
+ @override
+ String rotationRestUpNext(String name) {
+ return 'بعدی: $name';
+ }
+
+ @override
+ String get trainAnyway => 'به هر حال تمرین کن';
}
diff --git a/lib/l10n/app_localizations_fr.dart b/lib/l10n/app_localizations_fr.dart
index 007991a..b8f3c2f 100644
--- a/lib/l10n/app_localizations_fr.dart
+++ b/lib/l10n/app_localizations_fr.dart
@@ -5284,4 +5284,24 @@ class AppLocalizationsFr extends AppLocalizations {
@override
String get prepPortions => 'Portions';
+
+ @override
+ String get rotationAddRest => 'Ajouter un jour de repos';
+
+ @override
+ String get rotationRestHint => 'Passe toute seule le lendemain';
+
+ @override
+ String get rotationRestToday => 'Aujourd’hui';
+
+ @override
+ String get rotationSkipRest => 'Sauter ce jour de repos';
+
+ @override
+ String rotationRestUpNext(String name) {
+ return 'Ensuite : $name';
+ }
+
+ @override
+ String get trainAnyway => 'M’entraîner quand même';
}
diff --git a/lib/l10n/app_localizations_it.dart b/lib/l10n/app_localizations_it.dart
index 0059ad4..cafac5d 100644
--- a/lib/l10n/app_localizations_it.dart
+++ b/lib/l10n/app_localizations_it.dart
@@ -5276,4 +5276,24 @@ class AppLocalizationsIt extends AppLocalizations {
@override
String get prepPortions => 'Porzioni';
+
+ @override
+ String get rotationAddRest => 'Aggiungi un giorno di riposo';
+
+ @override
+ String get rotationRestHint => 'Passa da sola il giorno dopo';
+
+ @override
+ String get rotationRestToday => 'Oggi';
+
+ @override
+ String get rotationSkipRest => 'Salta questo riposo';
+
+ @override
+ String rotationRestUpNext(String name) {
+ return 'Poi: $name';
+ }
+
+ @override
+ String get trainAnyway => 'Allenati lo stesso';
}
diff --git a/lib/l10n/app_localizations_ja.dart b/lib/l10n/app_localizations_ja.dart
index fdb8664..fdc5270 100644
--- a/lib/l10n/app_localizations_ja.dart
+++ b/lib/l10n/app_localizations_ja.dart
@@ -5115,4 +5115,24 @@ class AppLocalizationsJa extends AppLocalizations {
@override
String get prepPortions => '等分';
+
+ @override
+ String get rotationAddRest => '休息日を追加';
+
+ @override
+ String get rotationRestHint => '翌日に自動で進みます';
+
+ @override
+ String get rotationRestToday => '今日';
+
+ @override
+ String get rotationSkipRest => 'この休息日をスキップ';
+
+ @override
+ String rotationRestUpNext(String name) {
+ return '次:$name';
+ }
+
+ @override
+ String get trainAnyway => 'それでもトレーニング';
}
diff --git a/lib/l10n/app_localizations_ko.dart b/lib/l10n/app_localizations_ko.dart
index def1676..63791a0 100644
--- a/lib/l10n/app_localizations_ko.dart
+++ b/lib/l10n/app_localizations_ko.dart
@@ -5126,4 +5126,24 @@ class AppLocalizationsKo extends AppLocalizations {
@override
String get prepPortions => '나누기';
+
+ @override
+ String get rotationAddRest => '휴식일 추가';
+
+ @override
+ String get rotationRestHint => '다음 날 자동으로 넘어가요';
+
+ @override
+ String get rotationRestToday => '오늘';
+
+ @override
+ String get rotationSkipRest => '이 휴식일 건너뛰기';
+
+ @override
+ String rotationRestUpNext(String name) {
+ return '다음: $name';
+ }
+
+ @override
+ String get trainAnyway => '그래도 운동하기';
}
diff --git a/lib/l10n/app_localizations_nl.dart b/lib/l10n/app_localizations_nl.dart
index a96943d..0485d66 100644
--- a/lib/l10n/app_localizations_nl.dart
+++ b/lib/l10n/app_localizations_nl.dart
@@ -5270,4 +5270,24 @@ class AppLocalizationsNl extends AppLocalizations {
@override
String get prepPortions => 'Porties';
+
+ @override
+ String get rotationAddRest => 'Rustdag toevoegen';
+
+ @override
+ String get rotationRestHint => 'Gaat de volgende dag vanzelf verder';
+
+ @override
+ String get rotationRestToday => 'Vandaag';
+
+ @override
+ String get rotationSkipRest => 'Deze rustdag overslaan';
+
+ @override
+ String rotationRestUpNext(String name) {
+ return 'Daarna: $name';
+ }
+
+ @override
+ String get trainAnyway => 'Toch trainen';
}
diff --git a/lib/l10n/app_localizations_pl.dart b/lib/l10n/app_localizations_pl.dart
index 7063fb9..052290a 100644
--- a/lib/l10n/app_localizations_pl.dart
+++ b/lib/l10n/app_localizations_pl.dart
@@ -5312,4 +5312,24 @@ class AppLocalizationsPl extends AppLocalizations {
@override
String get prepPortions => 'Porcje';
+
+ @override
+ String get rotationAddRest => 'Dodaj dzień odpoczynku';
+
+ @override
+ String get rotationRestHint => 'Mija sam następnego dnia';
+
+ @override
+ String get rotationRestToday => 'Dziś';
+
+ @override
+ String get rotationSkipRest => 'Pomiń ten odpoczynek';
+
+ @override
+ String rotationRestUpNext(String name) {
+ return 'Potem: $name';
+ }
+
+ @override
+ String get trainAnyway => 'Trenuj mimo to';
}
diff --git a/lib/l10n/app_localizations_pt.dart b/lib/l10n/app_localizations_pt.dart
index 19915f8..8a98760 100644
--- a/lib/l10n/app_localizations_pt.dart
+++ b/lib/l10n/app_localizations_pt.dart
@@ -5260,4 +5260,24 @@ class AppLocalizationsPt extends AppLocalizations {
@override
String get prepPortions => 'Porções';
+
+ @override
+ String get rotationAddRest => 'Adicionar dia de descanso';
+
+ @override
+ String get rotationRestHint => 'Avança sozinho no dia seguinte';
+
+ @override
+ String get rotationRestToday => 'Hoje';
+
+ @override
+ String get rotationSkipRest => 'Pular este descanso';
+
+ @override
+ String rotationRestUpNext(String name) {
+ return 'Depois: $name';
+ }
+
+ @override
+ String get trainAnyway => 'Treinar mesmo assim';
}
diff --git a/lib/l10n/app_localizations_ru.dart b/lib/l10n/app_localizations_ru.dart
index 598625d..bf34339 100644
--- a/lib/l10n/app_localizations_ru.dart
+++ b/lib/l10n/app_localizations_ru.dart
@@ -5384,4 +5384,24 @@ class AppLocalizationsRu extends AppLocalizations {
@override
String get prepPortions => 'Порции';
+
+ @override
+ String get rotationAddRest => 'Добавить день отдыха';
+
+ @override
+ String get rotationRestHint => 'Сам сменится на следующий день';
+
+ @override
+ String get rotationRestToday => 'Сегодня';
+
+ @override
+ String get rotationSkipRest => 'Пропустить этот отдых';
+
+ @override
+ String rotationRestUpNext(String name) {
+ return 'Дальше: $name';
+ }
+
+ @override
+ String get trainAnyway => 'Всё равно тренироваться';
}
diff --git a/lib/l10n/app_localizations_tr.dart b/lib/l10n/app_localizations_tr.dart
index 089a865..a531b7e 100644
--- a/lib/l10n/app_localizations_tr.dart
+++ b/lib/l10n/app_localizations_tr.dart
@@ -5266,4 +5266,24 @@ class AppLocalizationsTr extends AppLocalizations {
@override
String get prepPortions => 'Porsiyon';
+
+ @override
+ String get rotationAddRest => 'Dinlenme günü ekle';
+
+ @override
+ String get rotationRestHint => 'Ertesi gün kendiliğinden geçer';
+
+ @override
+ String get rotationRestToday => 'Bugün';
+
+ @override
+ String get rotationSkipRest => 'Bu dinlenmeyi atla';
+
+ @override
+ String rotationRestUpNext(String name) {
+ return 'Sonra: $name';
+ }
+
+ @override
+ String get trainAnyway => 'Yine de antrenman yap';
}
diff --git a/lib/l10n/app_localizations_uk.dart b/lib/l10n/app_localizations_uk.dart
index ac04e24..20cc7c6 100644
--- a/lib/l10n/app_localizations_uk.dart
+++ b/lib/l10n/app_localizations_uk.dart
@@ -5302,4 +5302,24 @@ class AppLocalizationsUk extends AppLocalizations {
@override
String get prepPortions => 'Порції';
+
+ @override
+ String get rotationAddRest => 'Додати день відпочинку';
+
+ @override
+ String get rotationRestHint => 'Сам зміниться наступного дня';
+
+ @override
+ String get rotationRestToday => 'Сьогодні';
+
+ @override
+ String get rotationSkipRest => 'Пропустити цей відпочинок';
+
+ @override
+ String rotationRestUpNext(String name) {
+ return 'Далі: $name';
+ }
+
+ @override
+ String get trainAnyway => 'Все одно тренуватися';
}
diff --git a/lib/l10n/app_localizations_zh.dart b/lib/l10n/app_localizations_zh.dart
index 01442d0..b73805a 100644
--- a/lib/l10n/app_localizations_zh.dart
+++ b/lib/l10n/app_localizations_zh.dart
@@ -5062,6 +5062,26 @@ class AppLocalizationsZh extends AppLocalizations {
@override
String get prepPortions => '份数';
+
+ @override
+ String get rotationAddRest => '添加休息日';
+
+ @override
+ String get rotationRestHint => '第二天会自动跳过';
+
+ @override
+ String get rotationRestToday => '今天';
+
+ @override
+ String get rotationSkipRest => '跳过这个休息日';
+
+ @override
+ String rotationRestUpNext(String name) {
+ return '接下来:$name';
+ }
+
+ @override
+ String get trainAnyway => '照样训练';
}
/// The translations for Chinese, using the Han script (`zh_Hant`).
@@ -9709,4 +9729,24 @@ class AppLocalizationsZhHant extends AppLocalizationsZh {
@override
String get prepPortions => '份數';
+
+ @override
+ String get rotationAddRest => '新增休息日';
+
+ @override
+ String get rotationRestHint => '隔天會自動跳過';
+
+ @override
+ String get rotationRestToday => '今天';
+
+ @override
+ String get rotationSkipRest => '跳過這個休息日';
+
+ @override
+ String rotationRestUpNext(String name) {
+ return '接下來:$name';
+ }
+
+ @override
+ String get trainAnyway => '照樣訓練';
}
diff --git a/lib/l10n/app_nl.arb b/lib/l10n/app_nl.arb
index 63e3a87..0e50f20 100644
--- a/lib/l10n/app_nl.arb
+++ b/lib/l10n/app_nl.arb
@@ -1406,5 +1406,11 @@
"autoBackupNever": "Nog geen back-up",
"autoBackupLost": "De laatste back-up is mislukt. Kies de map opnieuw.",
"autoBackupSaved": "Back-up opgeslagen",
- "prepPortions": "Porties"
+ "prepPortions": "Porties",
+ "rotationAddRest": "Rustdag toevoegen",
+ "rotationRestHint": "Gaat de volgende dag vanzelf verder",
+ "rotationRestToday": "Vandaag",
+ "rotationSkipRest": "Deze rustdag overslaan",
+ "rotationRestUpNext": "Daarna: {name}",
+ "trainAnyway": "Toch trainen"
}
diff --git a/lib/l10n/app_pl.arb b/lib/l10n/app_pl.arb
index 418618d..3814356 100644
--- a/lib/l10n/app_pl.arb
+++ b/lib/l10n/app_pl.arb
@@ -1406,5 +1406,11 @@
"autoBackupNever": "Brak kopii",
"autoBackupLost": "Nie udało się zapisać ostatniej kopii. Wybierz folder ponownie.",
"autoBackupSaved": "Kopia zapisana",
- "prepPortions": "Porcje"
+ "prepPortions": "Porcje",
+ "rotationAddRest": "Dodaj dzień odpoczynku",
+ "rotationRestHint": "Mija sam następnego dnia",
+ "rotationRestToday": "Dziś",
+ "rotationSkipRest": "Pomiń ten odpoczynek",
+ "rotationRestUpNext": "Potem: {name}",
+ "trainAnyway": "Trenuj mimo to"
}
diff --git a/lib/l10n/app_pt.arb b/lib/l10n/app_pt.arb
index 7cd3644..7af1298 100644
--- a/lib/l10n/app_pt.arb
+++ b/lib/l10n/app_pt.arb
@@ -1406,5 +1406,11 @@
"autoBackupNever": "Nenhum backup ainda",
"autoBackupLost": "Não deu para salvar o último backup. Escolha a pasta de novo.",
"autoBackupSaved": "Backup salvo",
- "prepPortions": "Porções"
+ "prepPortions": "Porções",
+ "rotationAddRest": "Adicionar dia de descanso",
+ "rotationRestHint": "Avança sozinho no dia seguinte",
+ "rotationRestToday": "Hoje",
+ "rotationSkipRest": "Pular este descanso",
+ "rotationRestUpNext": "Depois: {name}",
+ "trainAnyway": "Treinar mesmo assim"
}
diff --git a/lib/l10n/app_ru.arb b/lib/l10n/app_ru.arb
index e510379..430fe32 100644
--- a/lib/l10n/app_ru.arb
+++ b/lib/l10n/app_ru.arb
@@ -1406,5 +1406,11 @@
"autoBackupNever": "Копий пока нет",
"autoBackupLost": "Не удалось сохранить последнюю копию. Выберите папку заново.",
"autoBackupSaved": "Копия сохранена",
- "prepPortions": "Порции"
+ "prepPortions": "Порции",
+ "rotationAddRest": "Добавить день отдыха",
+ "rotationRestHint": "Сам сменится на следующий день",
+ "rotationRestToday": "Сегодня",
+ "rotationSkipRest": "Пропустить этот отдых",
+ "rotationRestUpNext": "Дальше: {name}",
+ "trainAnyway": "Всё равно тренироваться"
}
diff --git a/lib/l10n/app_tr.arb b/lib/l10n/app_tr.arb
index bef78ff..2d8fd2b 100644
--- a/lib/l10n/app_tr.arb
+++ b/lib/l10n/app_tr.arb
@@ -1406,5 +1406,11 @@
"autoBackupNever": "Henüz yedek yok",
"autoBackupLost": "Son yedek kaydedilemedi. Klasörü yeniden seç.",
"autoBackupSaved": "Yedek kaydedildi",
- "prepPortions": "Porsiyon"
+ "prepPortions": "Porsiyon",
+ "rotationAddRest": "Dinlenme günü ekle",
+ "rotationRestHint": "Ertesi gün kendiliğinden geçer",
+ "rotationRestToday": "Bugün",
+ "rotationSkipRest": "Bu dinlenmeyi atla",
+ "rotationRestUpNext": "Sonra: {name}",
+ "trainAnyway": "Yine de antrenman yap"
}
diff --git a/lib/l10n/app_uk.arb b/lib/l10n/app_uk.arb
index 153dd45..ca11682 100644
--- a/lib/l10n/app_uk.arb
+++ b/lib/l10n/app_uk.arb
@@ -1406,5 +1406,11 @@
"autoBackupNever": "Копій ще немає",
"autoBackupLost": "Не вдалося зберегти останню копію. Виберіть папку знову.",
"autoBackupSaved": "Копію збережено",
- "prepPortions": "Порції"
+ "prepPortions": "Порції",
+ "rotationAddRest": "Додати день відпочинку",
+ "rotationRestHint": "Сам зміниться наступного дня",
+ "rotationRestToday": "Сьогодні",
+ "rotationSkipRest": "Пропустити цей відпочинок",
+ "rotationRestUpNext": "Далі: {name}",
+ "trainAnyway": "Все одно тренуватися"
}
diff --git a/lib/l10n/app_zh.arb b/lib/l10n/app_zh.arb
index 85668ea..7890523 100644
--- a/lib/l10n/app_zh.arb
+++ b/lib/l10n/app_zh.arb
@@ -1406,5 +1406,11 @@
"autoBackupNever": "还没有备份",
"autoBackupLost": "上次备份没能保存,请重新选择文件夹。",
"autoBackupSaved": "备份已保存",
- "prepPortions": "份数"
+ "prepPortions": "份数",
+ "rotationAddRest": "添加休息日",
+ "rotationRestHint": "第二天会自动跳过",
+ "rotationRestToday": "今天",
+ "rotationSkipRest": "跳过这个休息日",
+ "rotationRestUpNext": "接下来:{name}",
+ "trainAnyway": "照样训练"
}
diff --git a/lib/l10n/app_zh_Hant.arb b/lib/l10n/app_zh_Hant.arb
index a87e8c4..50825c5 100644
--- a/lib/l10n/app_zh_Hant.arb
+++ b/lib/l10n/app_zh_Hant.arb
@@ -1406,5 +1406,11 @@
"autoBackupNever": "還沒有備份",
"autoBackupLost": "上次備份沒能儲存,請重新選擇資料夾。",
"autoBackupSaved": "備份已儲存",
- "prepPortions": "份數"
+ "prepPortions": "份數",
+ "rotationAddRest": "新增休息日",
+ "rotationRestHint": "隔天會自動跳過",
+ "rotationRestToday": "今天",
+ "rotationSkipRest": "跳過這個休息日",
+ "rotationRestUpNext": "接下來:{name}",
+ "trainAnyway": "照樣訓練"
}
diff --git a/lib/screens/home_screen.dart b/lib/screens/home_screen.dart
index eddfb78..f828660 100644
--- a/lib/screens/home_screen.dart
+++ b/lib/screens/home_screen.dart
@@ -232,20 +232,34 @@ class HomeScreen extends StatelessWidget {
}
Widget _hero(BuildContext context, GymColors gc) {
- final routine = fit.todayRoutine;
+ final rest = fit.restingToday ? fit.rotationUpcoming : null;
+ final routine = rest ?? fit.todayRoutine;
final focus = fit.suggestedFocus;
final isRoutine = routine != null && routine.exerciseIds.isNotEmpty;
- final label = isRoutine ? t.todaysRoutine : t.todaysFocus;
- final title = isRoutine ? fit.routineTitle(routine) : focus.title;
+ final label = rest != null
+ ? t.rotationTitle
+ : isRoutine
+ ? t.todaysRoutine
+ : t.todaysFocus;
+ final title = rest != null
+ ? t.restDayShort
+ : isRoutine
+ ? fit.routineTitle(routine)
+ : focus.title;
final today = fit.routinesOn(DateTime.now());
- final done = isRoutine && fit.pendingRoutinesOn(DateTime.now()).isEmpty;
- final subtitle = done
+ final done = rest == null && isRoutine && fit.pendingRoutinesOn(DateTime.now()).isEmpty;
+ final subtitle = rest != null
+ ? [
+ t.rotationRestUpNext(fit.routineTitle(rest)),
+ t.rotationPlace(fit.rotationStep + 1, fit.rotationSteps.length),
+ ].join(' · ')
+ : done
? t.routineDoneToday
: isRoutine
? [
t.exerciseCount(routine.exerciseIds.length),
if (fit.rotating)
- t.rotationPlace(fit.rotationStep + 1, fit.rotationRoutines.length)
+ t.rotationPlace(fit.rotationStep + 1, fit.rotationSteps.length)
else if (today.length > 1)
t.routineOfDay(today.indexOf(routine) + 1, today.length),
].join(' · ')
@@ -304,6 +318,10 @@ class HomeScreen extends StatelessWidget {
),
const SizedBox(width: 7),
],
+ if (rest != null) ...[
+ Icon(PhosphorIconsFill.bed, size: 14, color: gc.sage),
+ const SizedBox(width: 7),
+ ],
Text(label.toUpperCase(),
style: AppTheme.f(10.5,
weight: FontWeight.w700, color: gc.textTertiary, letterSpacing: 1.4)),
@@ -326,15 +344,19 @@ class HomeScreen extends StatelessWidget {
Row(children: [
Expanded(
child: PrimaryButton(
- label: done ? t.trainAgain : t.startWorkout,
+ label: rest != null
+ ? t.trainAnyway
+ : done
+ ? t.trainAgain
+ : t.startWorkout,
icon: Ic.play,
height: 52,
- bg: done ? gc.bgRaised2 : null,
- fg: done ? gc.text : null,
+ bg: done || rest != null ? gc.bgRaised2 : null,
+ fg: done || rest != null ? gc.text : null,
onTap: isRoutine ? () => fit.startRoutine(routine) : fit.startFocusWorkout,
),
),
- if (isRoutine && !done) ...[
+ if (isRoutine && !done && rest == null) ...[
const SizedBox(width: 10),
RoundAction(
label: t.moreOptions,
@@ -396,7 +418,11 @@ class HomeScreen extends StatelessWidget {
shape: BoxShape.circle,
border: isToday && !done ? Border.all(color: gc.ember, width: 2) : null,
),
- child: done ? Center(child: SvgPathIcon(Ic.checkBold, size: 13, color: gc.onEmber)) : null,
+ child: done
+ ? Center(child: SvgPathIcon(Ic.checkBold, size: 13, color: gc.onEmber))
+ : fit.rotationRestOn(fit.dateForWeekday(i))
+ ? Icon(PhosphorIconsFill.bed, size: 14, color: gc.sage)
+ : null,
),
],
),
diff --git a/lib/screens/routines_screen.dart b/lib/screens/routines_screen.dart
index 371a02c..6fa66cf 100644
--- a/lib/screens/routines_screen.dart
+++ b/lib/screens/routines_screen.dart
@@ -437,8 +437,9 @@ class RoutinesScreen extends StatelessWidget {
}
Widget _rotationCard(BuildContext context, GymColors gc) {
- final list = fit.rotationRoutines;
- final next = fit.rotationNext;
+ final list = fit.rotationSteps;
+ final step = fit.rotationStep;
+ final routines = fit.rotationRoutines;
return SoftCard(
radius: 20,
borderColor: Colors.transparent,
@@ -448,7 +449,7 @@ class RoutinesScreen extends StatelessWidget {
children: [
Padding(
padding: const EdgeInsets.symmetric(horizontal: 10),
- child: Text(list.isEmpty ? t.rotationEmpty : t.rotationHint,
+ child: Text(routines.isEmpty ? t.rotationEmpty : t.rotationHint,
style: AppTheme.f(12.5, weight: FontWeight.w500, color: gc.textSecondary, height: 1.35)),
),
if (list.length > 1) ...[
@@ -463,9 +464,9 @@ class RoutinesScreen extends StatelessWidget {
duration: const Duration(milliseconds: 260),
height: 5,
decoration: BoxDecoration(
- color: i < fit.rotationStep
+ color: i < step
? gc.sage
- : list[i] == next
+ : i == step
? gc.ember
: gc.bgRaised2,
borderRadius: BorderRadius.circular(3),
@@ -478,7 +479,7 @@ class RoutinesScreen extends StatelessWidget {
const SizedBox(height: 6),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 10),
- child: Text(t.rotationProgress(fit.rotationStep, list.length),
+ child: Text(t.rotationProgress(step, list.length),
style: AppTheme.f(11.5, weight: FontWeight.w600, color: gc.textTertiary)),
),
],
@@ -492,41 +493,167 @@ class RoutinesScreen extends StatelessWidget {
onReorderEnd: reorderDropped,
onReorder: fit.reorderRotation,
children: [
- for (var i = 0; i < list.length; i++) _rotationRow(context, gc, list[i], i, list[i] == next),
+ for (var i = 0; i < list.length; i++)
+ if (RoutinesState.isRestStep(list[i]))
+ _rotationRestRow(context, gc, list[i], i, i == step)
+ else
+ _rotationRow(context, gc, fit.routineById(list[i])!, i, i == step,
+ routines.indexWhere((r) => r.id == list[i])),
],
),
- GestureDetector(
+ _rotationAddRow(gc, PhosphorIconsBold.plus, t.rotationAdd, () => _pickRotation(context)),
+ if (routines.isNotEmpty)
+ _rotationAddRow(gc, PhosphorIconsRegular.bed, t.rotationAddRest, () {
+ HapticFeedback.selectionClick();
+ fit.addRotationRest();
+ }),
+ if (list.length > 1) ...[
+ Divider(height: 1, thickness: 1, indent: 12, endIndent: 12, color: gc.border),
+ Row(children: [
+ Expanded(child: _rotationAction(gc, PhosphorIconsRegular.skipForward, t.rotationSkip, fit.skipRotation)),
+ Container(width: 1, height: 18, color: gc.border),
+ Expanded(
+ child: _rotationAction(
+ gc, PhosphorIconsRegular.arrowCounterClockwise, t.rotationRestart, fit.restartRotation),
+ ),
+ ]),
+ ],
+ ],
+ ),
+ );
+ }
+
+ Widget _rotationAddRow(GymColors gc, IconData icon, String label, VoidCallback onTap) => GestureDetector(
+ behavior: HitTestBehavior.opaque,
+ onTap: onTap,
+ child: Padding(
+ padding: const EdgeInsets.fromLTRB(14, 12, 14, 12),
+ child: Row(children: [
+ Container(
+ width: 30,
+ height: 30,
+ decoration: BoxDecoration(
+ shape: BoxShape.circle,
+ border: Border.all(color: gc.border, width: 1.5),
+ ),
+ child: Icon(icon, size: 13, color: gc.textSecondary),
+ ),
+ const SizedBox(width: 12),
+ Text(label, style: AppTheme.f(14, weight: FontWeight.w600, color: gc.textSecondary)),
+ ]),
+ ),
+ );
+
+ Widget _rotationRestRow(BuildContext context, GymColors gc, String id, int i, bool isNext) {
+ final done = i < fit.rotationStep;
+ final today = isNext && fit.restingToday;
+ return Container(
+ key: ValueKey('rot-$id'),
+ margin: const EdgeInsets.symmetric(vertical: 2),
+ decoration: BoxDecoration(
+ color: isNext ? gc.sageSoft : gc.bgRaised,
+ borderRadius: BorderRadius.circular(14),
+ ),
+ child: Row(children: [
+ Expanded(
+ child: GestureDetector(
behavior: HitTestBehavior.opaque,
- onTap: () => _pickRotation(context),
+ onTap: () => _rotationRestMenu(context, id, isNext),
child: Padding(
- padding: const EdgeInsets.fromLTRB(14, 12, 14, 12),
+ padding: const EdgeInsets.fromLTRB(10, 10, 4, 10),
child: Row(children: [
Container(
width: 30,
height: 30,
+ alignment: Alignment.center,
decoration: BoxDecoration(
+ color: isNext ? gc.sage : (done ? gc.sageSoft : gc.bgRaised2),
shape: BoxShape.circle,
- border: Border.all(color: gc.border, width: 1.5),
),
- child: Icon(PhosphorIconsBold.plus, size: 13, color: gc.textSecondary),
+ child: done
+ ? Icon(PhosphorIconsBold.check, size: 13, color: gc.sage)
+ : Icon(PhosphorIconsFill.bed, size: 14, color: isNext ? gc.bg : gc.textSecondary),
),
const SizedBox(width: 12),
- Text(t.rotationAdd, style: AppTheme.f(14, weight: FontWeight.w600, color: gc.textSecondary)),
+ Expanded(
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(t.restDayShort,
+ maxLines: 1,
+ overflow: TextOverflow.ellipsis,
+ style: AppTheme.f(14.5, weight: FontWeight.w700, color: gc.text)),
+ const SizedBox(height: 1),
+ Text(
+ [
+ if (today) t.rotationRestToday else if (isNext) t.rotationNext,
+ t.rotationRestHint,
+ ].join(' · '),
+ maxLines: 1,
+ overflow: TextOverflow.ellipsis,
+ style: AppTheme.f(11.5,
+ weight: isNext ? FontWeight.w700 : FontWeight.w500,
+ color: isNext ? gc.sage : gc.textTertiary),
+ ),
+ ],
+ ),
+ ),
]),
),
),
- if (list.length > 1) ...[
- Divider(height: 1, thickness: 1, indent: 12, endIndent: 12, color: gc.border),
- Row(children: [
- Expanded(child: _rotationAction(gc, PhosphorIconsRegular.skipForward, t.rotationSkip, fit.skipRotation)),
- Container(width: 1, height: 18, color: gc.border),
- Expanded(
- child: _rotationAction(
- gc, PhosphorIconsRegular.arrowCounterClockwise, t.rotationRestart, fit.restartRotation),
- ),
+ ),
+ ReorderableDragStartListener(
+ index: i,
+ child: Semantics(
+ label: t.reorderHandle(t.restDayShort),
+ child: SizedBox(
+ width: 40,
+ height: 48,
+ child: Icon(PhosphorIconsRegular.dotsSixVertical, size: 18, color: gc.textTertiary),
+ ),
+ ),
+ ),
+ ]),
+ );
+ }
+
+ void _rotationRestMenu(BuildContext context, String id, bool isNext) {
+ final gc = context.gc;
+ showAppSheet<void>(
+ context: context,
+ backgroundColor: Colors.transparent,
+ builder: (sheet) => Container(
+ padding: sheetPad(sheet),
+ decoration: BoxDecoration(
+ color: gc.bgRaised,
+ borderRadius: const BorderRadius.vertical(top: Radius.circular(28)),
+ ),
+ child: Column(
+ mainAxisSize: MainAxisSize.min,
+ crossAxisAlignment: CrossAxisAlignment.stretch,
+ children: [
+ const SheetHandle(),
+ const SizedBox(height: 16),
+ SheetTitle(t.restDayShort, subtitle: t.rotationRestHint),
+ const SizedBox(height: 14),
+ OptionGroup([
+ if (isNext)
+ OptionItem(t.rotationSkipRest, icon: PhosphorIconsRegular.skipForward, onTap: () {
+ Navigator.pop(sheet);
+ fit.skipRotation();
+ })
+ else
+ OptionItem(t.rotationMakeNext, icon: PhosphorIconsRegular.flagPennant, onTap: () {
+ Navigator.pop(sheet);
+ fit.setRotationNext(id);
+ }),
+ OptionItem(t.rotationRemove, icon: PhosphorIconsRegular.minusCircle, danger: true, onTap: () {
+ Navigator.pop(sheet);
+ fit.removeRotationRest(id);
+ }),
]),
],
- ],
+ ),
),
);
}
@@ -552,8 +679,8 @@ class RoutinesScreen extends StatelessWidget {
),
);
- Widget _rotationRow(BuildContext context, GymColors gc, Routine r, int i, bool isNext) {
- final letter = String.fromCharCode(65 + i % 26);
+ Widget _rotationRow(BuildContext context, GymColors gc, Routine r, int i, bool isNext, int order) {
+ final letter = String.fromCharCode(65 + order % 26);
final done = i < fit.rotationStep;
return Container(
key: ValueKey('rot-${r.id}'),
@@ -710,7 +837,7 @@ class RoutinesScreen extends StatelessWidget {
OptionItem(
fit.routineTitle(r),
detail: fit.rotationIds.contains(r.id)
- ? String.fromCharCode(65 + fit.rotationIds.indexOf(r.id) % 26)
+ ? String.fromCharCode(65 + fit.rotationRoutines.indexOf(r) % 26)
: (r.group.isEmpty ? null : r.group),
selected: fit.rotationIds.contains(r.id),
onTap: () => fit.toggleRotationRoutine(r.id),
diff --git a/lib/services/plan_pdf.dart b/lib/services/plan_pdf.dart
index 4f8b087..ad17113 100644
--- a/lib/services/plan_pdf.dart
+++ b/lib/services/plan_pdf.dart
@@ -177,7 +177,7 @@ class _PlanDoc {
_header(routines, week: week, now: now);
if (week) {
if (fit.rotation && fit.rotationRoutines.isNotEmpty) {
- _rotation(fit.rotationRoutines);
+ _rotation(fit.rotationSteps);
} else {
_week();
}
@@ -295,13 +295,14 @@ class _PlanDoc {
_y += height + 26;
}
- void _rotation(List<Routine> list) {
+ void _rotation(List<String> list) {
_y += _text(t.planRotation.toUpperCase(), _st(8, weight: FontWeight.w800, color: _accent, spacing: 1.4), _margin, _y, _contentW);
_y += 8;
var x = 0.0;
const h = 26.0;
for (var i = 0; i < list.length; i++) {
- final label = '${i + 1} ${fit.routineTitle(list[i])}';
+ final routine = fit.routineById(list[i]);
+ final label = '${i + 1} ${routine == null ? t.restDayShort : fit.routineTitle(routine)}';
final w = math.min(160.0, _textWidth(label, _st(10, weight: FontWeight.w800))) + 24;
final arrow = i < list.length - 1 ? 18.0 : 0.0;
if (x + w > _contentW) {
@@ -309,7 +310,7 @@ class _PlanDoc {
_y += h + 8;
}
_rect(_margin + x, _y, w, h, _soft, radius: 13);
- _rect(_margin + x + 9, _y + 9, 8, 8, folderHue(list[i]), radius: 4);
+ _rect(_margin + x + 9, _y + 9, 8, 8, routine == null ? _faint : folderHue(routine), radius: 4);
final fitted = _measure(label, _st(10, weight: FontWeight.w800), w - 24);
final at = Offset(_x(_margin + x + 20, w - 24), _y + (h - fitted.height) / 2);
_add((c) => fitted.paint(c, at));
diff --git a/lib/services/train_reminder.dart b/lib/services/train_reminder.dart
index 2a5a13e..4bc77fb 100644
--- a/lib/services/train_reminder.dart
+++ b/lib/services/train_reminder.dart
@@ -53,10 +53,12 @@ class TrainReminder {
required Set<int> weekdays,
bool skipToday = false,
int againMinutes = 0,
+ bool Function(DateTime day)? restOn,
}) =>
- _serial(() => _schedule(minuteOfDay, weekdays, skipToday, againMinutes));
+ _serial(() => _schedule(minuteOfDay, weekdays, skipToday, againMinutes, restOn));
- Future<void> _schedule(int minuteOfDay, Set<int> weekdays, bool skipToday, int againMinutes) async {
+ Future<void> _schedule(
+ int minuteOfDay, Set<int> weekdays, bool skipToday, int againMinutes, bool Function(DateTime day)? restOn) async {
if (!enabled) return;
await _cancel();
final mode = await reminderMode(_plugin);
@@ -69,6 +71,7 @@ class TrainReminder {
: null;
if (!day.isAfter(now) && !(again?.isAfter(now) ?? false)) continue;
if (weekdays.isNotEmpty && !weekdays.contains(day.weekday)) continue;
+ if (restOn?.call(day) ?? false) continue;
try {
if (again != null && again.isAfter(now)) {
await _plugin.zonedSchedule(
diff --git a/lib/state/fit_core.dart b/lib/state/fit_core.dart
index f9db515..69584c7 100644
--- a/lib/state/fit_core.dart
+++ b/lib/state/fit_core.dart
@@ -55,6 +55,7 @@ abstract class FitCore extends ChangeNotifier {
bool rotation = false;
final List<String> rotationIds = [];
String rotationNextId = '';
+ DateTime? rotationRestDay;
final Map<String, List<String>> planMoves = {};
final List<Exercise> customExercises = [];
final List<GymPlace> places = [];
diff --git a/lib/state/fit_state.dart b/lib/state/fit_state.dart
index 10a25f3..544c5a2 100644
--- a/lib/state/fit_state.dart
+++ b/lib/state/fit_state.dart
@@ -272,6 +272,7 @@ class FitState extends FitCore
..clear()
..addAll(((data['rotationIds'] as List?) ?? const []).cast<String>());
rotationNextId = data['rotationNext'] as String? ?? '';
+ rotationRestDay = DateTime.tryParse(data['rotationRest'] as String? ?? '');
planMoves
..clear()
..addAll(((data['planMoves'] as Map?) ?? const {})
@@ -479,6 +480,7 @@ class FitState extends FitCore
if (rotation) 'rotation': rotation,
if (rotationIds.isNotEmpty) 'rotationIds': rotationIds,
if (rotationNextId.isNotEmpty) 'rotationNext': rotationNextId,
+ if (rotationRestDay != null) 'rotationRest': RoutinesState._moveKey(rotationRestDay!),
if (planMoves.isNotEmpty) 'planMoves': planMoves,
'custom': customExercises.map((e) => e.toJson()).toList(),
'media': exerciseMedia,
@@ -547,6 +549,7 @@ class FitState extends FitCore
rotation = false;
rotationIds.clear();
rotationNextId = '';
+ rotationRestDay = null;
planMoves.clear();
customExercises.clear();
exerciseMedia.clear();
@@ -764,6 +767,7 @@ class FitState extends FitCore
weekdays: reminderWeekdays,
skipToday: trainedToday,
againMinutes: trainAgainMin,
+ restOn: rotating ? rotationRestOn : null,
);
}
@@ -775,6 +779,7 @@ class FitState extends FitCore
final days = usualWeekdays;
if (days.isNotEmpty) return days.toSet();
}
+ if (rotating) return const {};
return weeklyPlan.keys.toSet();
}
diff --git a/lib/state/routines_state.dart b/lib/state/routines_state.dart
index 5122e34..d942471 100644
--- a/lib/state/routines_state.dart
+++ b/lib/state/routines_state.dart
@@ -182,19 +182,59 @@ mixin RoutinesState on FitCore, LibraryState {
bool movedOn(DateTime day) => planMoves.containsKey(_moveKey(day));
+ Routine? routineById(String id) => _routine(id);
+
bool get rotating => rotation && rotationRoutines.isNotEmpty;
List<Routine> get rotationRoutines => [for (final id in rotationIds) ?_routine(id)];
+ static bool isRestStep(String id) => id.startsWith('rest-');
+
+ List<String> get rotationSteps => [
+ for (final id in rotationIds)
+ if (isRestStep(id) || _routine(id) != null) id,
+ ];
+
+ ({int index, DateTime? rest}) get _rotationCursor {
+ final steps = rotationSteps;
+ if (rotationRoutines.isEmpty) return (index: 0, rest: null);
+ var i = steps.indexOf(rotationNextId);
+ if (i < 0) i = 0;
+ if (!isRestStep(steps[i])) return (index: i, rest: null);
+ final today = _dayKey(DateTime.now());
+ var day = _dayKey(rotationRestDay ?? today);
+ while (isRestStep(steps[i]) && day.isBefore(today)) {
+ i = (i + 1) % steps.length;
+ day = shiftDays(day, 1);
+ }
+ return (index: i, rest: isRestStep(steps[i]) ? day : null);
+ }
+
Routine? get rotationNext {
- final list = rotationRoutines;
- if (list.isEmpty) return null;
- return _routine(rotationNextId) ?? list.first;
+ if (rotationRoutines.isEmpty) return null;
+ final c = _rotationCursor;
+ return c.rest == null ? _routine(rotationSteps[c.index]) : null;
+ }
+
+ Routine? get rotationUpcoming {
+ final steps = rotationSteps;
+ if (rotationRoutines.isEmpty) return null;
+ var i = _rotationCursor.index;
+ while (isRestStep(steps[i])) {
+ i = (i + 1) % steps.length;
+ }
+ return _routine(steps[i]);
}
- int get rotationStep {
- final next = rotationNext;
- return next == null ? 0 : rotationRoutines.indexOf(next);
+ int get rotationStep => rotationRoutines.isEmpty ? 0 : _rotationCursor.index;
+
+ bool get restingToday => rotationRestOn(DateTime.now());
+
+ bool rotationRestOn(DateTime day) {
+ if (!rotating) return false;
+ final key = _dayKey(day);
+ if (key.isBefore(_dayKey(DateTime.now())) || sessions.any((s) => _dayKey(s.day) == key)) return false;
+ return _rotationOn(day).isEmpty;
}
List<Routine> _rotationOn(DateTime day) {
@@ -205,7 +245,17 @@ mixin RoutinesState on FitCore, LibraryState {
if (_dayKey(s.day) == key && s.routineId != null && rotationIds.contains(s.routineId)) ?_routine(s.routineId!),
];
if (key.isBefore(today) || done.isNotEmpty) return done;
- return [?rotationNext];
+ final steps = rotationSteps;
+ final c = _rotationCursor;
+ var rest = c.rest;
+ if (rest == null) return [?_routine(steps[c.index])];
+ var i = c.index;
+ while (isRestStep(steps[i])) {
+ if (!key.isAfter(rest!)) return const [];
+ i = (i + 1) % steps.length;
+ rest = shiftDays(rest, 1);
+ }
+ return [?_routine(steps[i])];
}
@override
@@ -228,8 +278,41 @@ mixin RoutinesState on FitCore, LibraryState {
_planChanged();
}
+ void addRotationRest() {
+ var n = 1;
+ while (rotationIds.contains('rest-$n')) {
+ n++;
+ }
+ rotationIds.add('rest-$n');
+ _planChanged();
+ }
+
+ void removeRotationRest(String id) {
+ final steps = rotationSteps;
+ final i = steps.indexOf(id);
+ if (i < 0 || !isRestStep(id)) return;
+ _settleRotation();
+ if (rotationNextId == id) _pointRotation(steps[(i + 1) % steps.length]);
+ rotationIds.remove(id);
+ _fixRotationNext();
+ _planChanged();
+ }
+
+ void _settleRotation() {
+ if (rotationRoutines.isEmpty) return;
+ final c = _rotationCursor;
+ rotationNextId = rotationSteps[c.index];
+ rotationRestDay = c.rest;
+ }
+
+ void _pointRotation(String id, [DateTime? rest]) {
+ rotationNextId = id;
+ rotationRestDay = isRestStep(id) ? _dayKey(rest ?? DateTime.now()) : null;
+ }
+
void toggleRotationRoutine(String id) {
if (_routine(id) == null) return;
+ _settleRotation();
if (rotationIds.remove(id)) {
if (rotationNextId == id) rotationNextId = '';
} else {
@@ -241,6 +324,7 @@ mixin RoutinesState on FitCore, LibraryState {
void reorderRotation(int from, int to) {
if (from < 0 || from >= rotationIds.length) return;
+ _settleRotation();
if (to > from) to -= 1;
rotationIds.insert(to.clamp(0, rotationIds.length), rotationIds.removeAt(from));
_planChanged();
@@ -248,36 +332,36 @@ mixin RoutinesState on FitCore, LibraryState {
void setRotationNext(String id) {
if (!rotationIds.contains(id)) return;
- rotationNextId = id;
+ _pointRotation(id);
_planChanged();
}
void skipRotation() {
- final list = rotationRoutines;
- final next = rotationNext;
- if (next == null) return;
- rotationNextId = list[(list.indexOf(next) + 1) % list.length].id;
+ final steps = rotationSteps;
+ if (rotationRoutines.isEmpty) return;
+ _pointRotation(steps[(_rotationCursor.index + 1) % steps.length]);
_planChanged();
}
void restartRotation() {
- final list = rotationRoutines;
- if (list.isEmpty) return;
- rotationNextId = list.first.id;
+ final steps = rotationSteps;
+ if (rotationRoutines.isEmpty) return;
+ _pointRotation(steps.first);
_planChanged();
}
- void _advanceRotation(String? routineId) {
+ void _advanceRotation(String? routineId, DateTime on) {
if (!rotation || routineId == null) return;
- final list = rotationRoutines;
- final i = list.indexWhere((r) => r.id == routineId);
+ final steps = rotationSteps;
+ final i = steps.indexOf(routineId);
if (i < 0) return;
- rotationNextId = list[(i + 1) % list.length].id;
+ _pointRotation(steps[(i + 1) % steps.length], shiftDays(on, 1));
}
void _fixRotationNext() {
- rotationIds.removeWhere((id) => _routine(id) == null);
- if (!rotationIds.contains(rotationNextId)) rotationNextId = rotationIds.isEmpty ? '' : rotationIds.first;
+ rotationIds.removeWhere((id) => !isRestStep(id) && _routine(id) == null);
+ if (rotationIds.contains(rotationNextId)) return;
+ _pointRotation(rotationIds.isEmpty ? '' : rotationIds.first);
}
VoidCallback? moveRoutineDay(String routineId, DateTime from, DateTime to) {
@@ -475,7 +559,7 @@ mixin RoutinesState on FitCore, LibraryState {
void _unplanRoutine(String id) {
final i = rotationIds.indexOf(id);
if (i >= 0) {
- if (rotationNextId == id) rotationNextId = rotationIds[(i + 1) % rotationIds.length];
+ if (rotationNextId == id) _pointRotation(rotationIds[(i + 1) % rotationIds.length]);
rotationIds.removeAt(i);
}
_fixRotationNext();
diff --git a/lib/state/workout_state.dart b/lib/state/workout_state.dart
index f6a6fe4..40a1005 100644
--- a/lib/state/workout_state.dart
+++ b/lib/state/workout_state.dart
@@ -1477,8 +1477,8 @@ mixin WorkoutState on FitCore, SettingsState, LibraryState, PlacesState, StatsSt
final entry = LoggedSession(s.loggedAt ?? DateTime.now(), s.summaryDuration ?? 0, logged, routineId: s.routineId, name: s.name);
sessions.add(entry);
sessions.sort((a, b) => a.date.compareTo(b.date));
- _rotationBefore = rotationNextId;
- _advanceRotation(entry.routineId);
+ _rotationBefore = (rotationNextId, rotationRestDay);
+ _advanceRotation(entry.routineId, entry.date);
_filed = entry;
_computeSummaryHighlights(entry);
_offerLevelUp(entry);
@@ -1749,7 +1749,7 @@ mixin WorkoutState on FitCore, SettingsState, LibraryState, PlacesState, StatsSt
}
LoggedSession? _filed;
- String? _rotationBefore;
+ (String, DateTime?)? _rotationBefore;
LoggedSession? get filedSession => _filed;
@@ -1780,7 +1780,10 @@ mixin WorkoutState on FitCore, SettingsState, LibraryState, PlacesState, StatsSt
if (filed != null) {
sessions.remove(filed);
final back = _rotationBefore;
- if (back != null) rotationNextId = back;
+ if (back != null) {
+ rotationNextId = back.$1;
+ rotationRestDay = back.$2;
+ }
}
_filed = null;
_rotationBefore = null;
diff --git a/test/rotation_test.dart b/test/rotation_test.dart
index e93ea8b..8552e78 100644
--- a/test/rotation_test.dart
+++ b/test/rotation_test.dart
@@ -218,4 +218,195 @@ void main() {
expect(fit.rotationRoutines.map((r) => r.id), [a.id, b.id]);
});
});
+
+ group('días de descanso en la rotación', () {
+ setUp(() async {
+ SharedPreferences.setMockInitialValues({});
+ await Store.instance.init();
+ fit.resetAllData();
+ fit.onboarded = true;
+ });
+
+ tearDown(() {
+ if (fit.session != null) fit.saveAndExit();
+ });
+
+ String bench() => fit.matchExerciseByName('Bench Press')!.id;
+
+ Routine routine(String name) {
+ final id = fit.createRoutine(name);
+ fit.toggleRoutineExercise(id, bench());
+ return fit.routines.firstWhere((r) => r.id == id);
+ }
+
+ void train(Routine r, {DateTime? on}) {
+ fit.startRoutine(r, on: on);
+ fit.endCountdown();
+ fit.toggleSet(0, 0);
+ fit.finishSession();
+ fit.saveAndExit();
+ }
+
+ DateTime day(int offset) {
+ final n = DateTime.now();
+ return DateTime(n.year, n.month, n.day + offset, 10);
+ }
+
+ List<String> cycle(List<Object> steps) {
+ fit.setRotation(true);
+ for (final s in steps) {
+ if (s is Routine) {
+ fit.toggleRotationRoutine(s.id);
+ } else {
+ fit.addRotationRest();
+ }
+ }
+ return [...fit.rotationIds];
+ }
+
+ test('el día después de la última toca descanso y al otro sigue la siguiente', () {
+ final legs = routine('Legs'), push = routine('Push');
+ cycle([legs, 'rest', push]);
+ train(legs, on: day(-1));
+
+ expect(fit.restingToday, isTrue);
+ expect(fit.todayRoutine, isNull);
+ expect(fit.rotationNext, isNull);
+ expect(fit.rotationUpcoming?.id, push.id);
+ expect(fit.rotationStep, 1);
+ expect(fit.isTrainingDay(DateTime.now()), isFalse);
+ expect(fit.routinesOn(day(1)).single.id, push.id);
+ expect(fit.rotationRestOn(day(1)), isFalse);
+ });
+
+ test('el descanso pasa solo cuando acaba su día', () {
+ final legs = routine('Legs'), push = routine('Push');
+ cycle([legs, 'rest', push]);
+ train(legs, on: day(-2));
+
+ expect(fit.restingToday, isFalse);
+ expect(fit.rotationNext?.id, push.id);
+ expect(fit.todayRoutine?.id, push.id);
+ });
+
+ test('dos descansos seguidos son dos días', () {
+ final legs = routine('Legs'), push = routine('Push');
+ cycle([legs, 'rest', 'rest', push]);
+ train(legs, on: day(-1));
+
+ expect(fit.restingToday, isTrue);
+ expect(fit.rotationRestOn(day(1)), isTrue);
+ expect(fit.routinesOn(day(1)), isEmpty);
+ expect(fit.routinesOn(day(2)).single.id, push.id);
+ });
+
+ test('hoy entrenado y mañana descanso', () {
+ final legs = routine('Legs'), push = routine('Push');
+ cycle([legs, 'rest', push]);
+ train(legs);
+
+ expect(fit.restingToday, isFalse);
+ expect(fit.todayPlanDone, isTrue);
+ expect(fit.rotationRestOn(day(1)), isTrue);
+ expect(fit.routinesOn(day(2)).single.id, push.id);
+ });
+
+ test('entrenar en un día de descanso sigue la rueda desde esa rutina', () {
+ final legs = routine('Legs'), push = routine('Push'), pull = routine('Pull');
+ cycle([legs, 'rest', push, pull]);
+ train(legs, on: day(-1));
+ expect(fit.restingToday, isTrue);
+
+ train(push);
+ expect(fit.restingToday, isFalse);
+ expect(fit.rotationNext?.id, pull.id);
+ });
+
+ test('saltar el descanso pone hoy la siguiente', () {
+ final legs = routine('Legs'), push = routine('Push');
+ cycle([legs, 'rest', push]);
+ train(legs, on: day(-1));
+
+ fit.skipRotation();
+ expect(fit.restingToday, isFalse);
+ expect(fit.todayRoutine?.id, push.id);
+ });
+
+ test('elegir un descanso como siguiente lo deja para hoy', () {
+ final push = routine('Push'), pull = routine('Pull');
+ final ids = cycle([push, pull, 'rest']);
+ fit.setRotationNext(ids[2]);
+ expect(fit.restingToday, isTrue);
+ expect(fit.rotationUpcoming?.id, push.id);
+ });
+
+ test('quitar el descanso de hoy pasa al siguiente paso', () {
+ final legs = routine('Legs'), push = routine('Push');
+ final ids = cycle([legs, 'rest', push]);
+ train(legs, on: day(-1));
+
+ fit.removeRotationRest(ids[1]);
+ expect(fit.rotationIds, [legs.id, push.id]);
+ expect(fit.todayRoutine?.id, push.id);
+ });
+
+ test('varios descansos, se mueven y se guardan con su día', () {
+ final legs = routine('Legs'), push = routine('Push');
+ final ids = cycle([legs, 'rest', push, 'rest']);
+ expect(ids[1], isNot(ids[3]));
+ train(legs, on: day(-1));
+
+ fit.persistNow();
+ fit.rotationIds.clear();
+ fit.rotationRestDay = null;
+ fit.loadFromStore();
+ expect(fit.rotationIds, ids);
+ expect(fit.restingToday, isTrue);
+
+ fit.reorderRotation(3, 0);
+ expect(fit.rotationIds, [ids[3], legs.id, ids[1], push.id]);
+ expect(fit.restingToday, isTrue);
+ expect(fit.rotationStep, 2);
+ });
+
+ test('solo descansos no es una rotación', () {
+ fit.setRotation(true);
+ fit.addRotationRest();
+ expect(fit.rotating, isFalse);
+ expect(fit.restingToday, isFalse);
+ expect(fit.todayRoutine, isNull);
+ });
+
+ test('sin descansos todo sigue como antes', () {
+ final a = routine('A'), b = routine('B');
+ cycle([a, b]);
+ train(a, on: day(-3));
+ expect(fit.rotationNext?.id, b.id);
+ expect(fit.routinesOn(day(4)).single.id, b.id);
+ expect(fit.rotationRestOn(day(1)), isFalse);
+ });
+
+ test('con rotación el aviso vale para cualquier día', () {
+ final a = routine('A');
+ fit.assignRoutineToDay(DateTime.monday, a.id);
+ expect(fit.reminderWeekdays, {DateTime.monday});
+ cycle([]);
+ expect(fit.reminderWeekdays, isEmpty);
+ });
+
+ test('volver al entreno desde el resumen deja el descanso como estaba', () {
+ final legs = routine('Legs'), push = routine('Push');
+ cycle([legs, 'rest', push]);
+ train(legs, on: day(-1));
+ expect(fit.restingToday, isTrue);
+
+ fit.startRoutine(push);
+ fit.endCountdown();
+ fit.toggleSet(0, 0);
+ fit.finishSession();
+ expect(fit.restingToday, isFalse);
+ fit.continueSession();
+ expect(fit.restingToday, isTrue);
+ });
+ });
}