action prep, activity association removal, activity ui tweaks

This commit is contained in:
Joshua Burman
2025-01-06 10:10:08 -05:00
parent 7ead6ba631
commit ebca90e69a
7 changed files with 278 additions and 153 deletions

View File

@ -19,9 +19,9 @@ class ActivityTimerModel with ChangeNotifier {
int get actionCount => _actionCounter;
int get currentActionNum => _currentActionNum;
dynamic get currentAction => currentSet[_currentActionNum];
dynamic get currentAction => currentSet.isNotEmpty ? currentSet[_currentActionNum] : {};
int get currentSetNum => _currentSetNum;
dynamic get currentSet => _sets[_currentSetNum];
dynamic get currentSet => _sets.isNotEmpty ? _sets[_currentSetNum] : {};
Activity? get activity => _activity;
List get sets => _sets;
Timer? get periodicTimer => _periodicTimer;
@ -36,7 +36,7 @@ class ActivityTimerModel with ChangeNotifier {
_isc = null;
_activity = activity;
// only one action for now
_sets = json.decode(actions[0].set);
_sets = actions.isNotEmpty ? json.decode(actions[0].set) : [];
// _actions = actions;
_currentActionNum = 0;
_currentSetNum = 0;
@ -92,7 +92,7 @@ class ActivityTimerModel with ChangeNotifier {
}
void setActionCount() {
_actionCounter = currentAction['amount'];
_actionCounter = currentAction.isNotEmpty ? currentAction['amount'] : 0;
}
void pause() {