show rep and set counts

This commit is contained in:
Joshua Burman 2024-11-30 12:37:38 -05:00
parent 1564d6cd83
commit d42696df61
3 changed files with 35 additions and 15 deletions

View File

@ -29,13 +29,13 @@ class _ActivitiesScreenState extends State<ActivitiesScreen> {
activityActionSet: Set(
type: 'drop_set',
total: 3,
rest: 3000,
rest: 300000,
reps: Reps(
type: 'count',
tempo: [2, 3, 5],
amounts: [5, 3, 2],
weights: [50, 70, 80],
rest: 200))),
rest: 20000))),
));
@override

View File

@ -19,14 +19,34 @@ class ActivityView extends StatefulWidget {
class _ActivityViewState extends State<ActivityView> {
Timer? _periodicTimer;
int _tickCount = 0;
int currentSet = 0;
int currentRep = 0;
int _currentSet = 1;
int _currentRep = 1;
String _currentState = 'Rep';
void _startPeriodicTimer() {
_tickCount = widget.activity.actions[0].activityActionSet.rest ~/ 10000;
const oneSecond = Duration(seconds: 1);
_periodicTimer = Timer.periodic(oneSecond, (Timer timer) {
setState(() {
_tickCount++;
if (_tickCount == 0) {
if (_currentSet ==
widget.activity.actions[0].activityActionSet.total) {
timer.cancel();
}
if (_currentRep ==
widget.activity.actions[0].activityActionSet.reps
.amounts[_currentSet]) {
_currentSet++;
_currentRep = 1;
_tickCount =
widget.activity.actions[0].activityActionSet.rest ~/ 10000;
} else {
_currentRep++;
}
} else {
_tickCount--;
}
});
});
}
@ -94,14 +114,14 @@ class _ActivityViewState extends State<ActivityView> {
textAlign: TextAlign.center,
'$_tickCount'),
),
const Expanded(
Expanded(
flex: 1,
child: Padding(
padding: EdgeInsets.only(right: 10),
padding: const EdgeInsets.only(right: 10),
child: Text(
style: TextStyle(fontSize: 15),
style: const TextStyle(fontSize: 15),
textAlign: TextAlign.right,
'Set: 1/3 \nRep: 1/5'))),
'Set: $_currentSet/3 \nRep: $_currentRep/5'))),
])));
return Column(
crossAxisAlignment: CrossAxisAlignment.start, children: content);

View File

@ -57,13 +57,13 @@ class SessionCard extends StatelessWidget {
activityActionSet: Set(
type: 'drop_set',
total: 3,
rest: 3000,
rest: 300000,
reps: Reps(
type: 'count',
tempo: [2, 3, 5],
amounts: [5, 3, 2],
weights: [50, 70, 80],
rest: 200))),
rest: 20000))),
],
resources: ['https://www.youtube.com/watch?v=bLz0xp1PEm4']),
ActivityModel(
@ -94,13 +94,13 @@ class SessionCard extends StatelessWidget {
activityActionSet: Set(
type: 'drop_set',
total: 3,
rest: 3000,
rest: 300000,
reps: Reps(
type: 'count',
tempo: [2, 3, 5],
amounts: [5, 3, 2],
weights: [50, 70, 80],
rest: 200))),
rest: 20000))),
],
resources: ['https://www.youtube.com/watch?v=dyAvbUvY_PU']),
ActivityModel(
@ -131,13 +131,13 @@ class SessionCard extends StatelessWidget {
activityActionSet: Set(
type: 'drop_set',
total: 3,
rest: 3000,
rest: 300000,
reps: Reps(
type: 'count',
tempo: [2, 3, 5],
amounts: [5, 3, 2],
weights: [50, 70, 80],
rest: 200))),
rest: 20000))),
],
resources: ['https://www.youtube.com/watch?v=dyAvbUvY_PU']),
],