show rep and set counts
This commit is contained in:
parent
1564d6cd83
commit
d42696df61
@ -29,13 +29,13 @@ class _ActivitiesScreenState extends State<ActivitiesScreen> {
|
|||||||
activityActionSet: Set(
|
activityActionSet: Set(
|
||||||
type: 'drop_set',
|
type: 'drop_set',
|
||||||
total: 3,
|
total: 3,
|
||||||
rest: 3000,
|
rest: 300000,
|
||||||
reps: Reps(
|
reps: Reps(
|
||||||
type: 'count',
|
type: 'count',
|
||||||
tempo: [2, 3, 5],
|
tempo: [2, 3, 5],
|
||||||
amounts: [5, 3, 2],
|
amounts: [5, 3, 2],
|
||||||
weights: [50, 70, 80],
|
weights: [50, 70, 80],
|
||||||
rest: 200))),
|
rest: 20000))),
|
||||||
));
|
));
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -19,14 +19,34 @@ class ActivityView extends StatefulWidget {
|
|||||||
class _ActivityViewState extends State<ActivityView> {
|
class _ActivityViewState extends State<ActivityView> {
|
||||||
Timer? _periodicTimer;
|
Timer? _periodicTimer;
|
||||||
int _tickCount = 0;
|
int _tickCount = 0;
|
||||||
int currentSet = 0;
|
int _currentSet = 1;
|
||||||
int currentRep = 0;
|
int _currentRep = 1;
|
||||||
|
String _currentState = 'Rep';
|
||||||
|
|
||||||
void _startPeriodicTimer() {
|
void _startPeriodicTimer() {
|
||||||
|
_tickCount = widget.activity.actions[0].activityActionSet.rest ~/ 10000;
|
||||||
const oneSecond = Duration(seconds: 1);
|
const oneSecond = Duration(seconds: 1);
|
||||||
_periodicTimer = Timer.periodic(oneSecond, (Timer timer) {
|
_periodicTimer = Timer.periodic(oneSecond, (Timer timer) {
|
||||||
setState(() {
|
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,
|
textAlign: TextAlign.center,
|
||||||
'$_tickCount'),
|
'$_tickCount'),
|
||||||
),
|
),
|
||||||
const Expanded(
|
Expanded(
|
||||||
flex: 1,
|
flex: 1,
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: EdgeInsets.only(right: 10),
|
padding: const EdgeInsets.only(right: 10),
|
||||||
child: Text(
|
child: Text(
|
||||||
style: TextStyle(fontSize: 15),
|
style: const TextStyle(fontSize: 15),
|
||||||
textAlign: TextAlign.right,
|
textAlign: TextAlign.right,
|
||||||
'Set: 1/3 \nRep: 1/5'))),
|
'Set: $_currentSet/3 \nRep: $_currentRep/5'))),
|
||||||
])));
|
])));
|
||||||
return Column(
|
return Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start, children: content);
|
crossAxisAlignment: CrossAxisAlignment.start, children: content);
|
||||||
|
@ -57,13 +57,13 @@ class SessionCard extends StatelessWidget {
|
|||||||
activityActionSet: Set(
|
activityActionSet: Set(
|
||||||
type: 'drop_set',
|
type: 'drop_set',
|
||||||
total: 3,
|
total: 3,
|
||||||
rest: 3000,
|
rest: 300000,
|
||||||
reps: Reps(
|
reps: Reps(
|
||||||
type: 'count',
|
type: 'count',
|
||||||
tempo: [2, 3, 5],
|
tempo: [2, 3, 5],
|
||||||
amounts: [5, 3, 2],
|
amounts: [5, 3, 2],
|
||||||
weights: [50, 70, 80],
|
weights: [50, 70, 80],
|
||||||
rest: 200))),
|
rest: 20000))),
|
||||||
],
|
],
|
||||||
resources: ['https://www.youtube.com/watch?v=bLz0xp1PEm4']),
|
resources: ['https://www.youtube.com/watch?v=bLz0xp1PEm4']),
|
||||||
ActivityModel(
|
ActivityModel(
|
||||||
@ -94,13 +94,13 @@ class SessionCard extends StatelessWidget {
|
|||||||
activityActionSet: Set(
|
activityActionSet: Set(
|
||||||
type: 'drop_set',
|
type: 'drop_set',
|
||||||
total: 3,
|
total: 3,
|
||||||
rest: 3000,
|
rest: 300000,
|
||||||
reps: Reps(
|
reps: Reps(
|
||||||
type: 'count',
|
type: 'count',
|
||||||
tempo: [2, 3, 5],
|
tempo: [2, 3, 5],
|
||||||
amounts: [5, 3, 2],
|
amounts: [5, 3, 2],
|
||||||
weights: [50, 70, 80],
|
weights: [50, 70, 80],
|
||||||
rest: 200))),
|
rest: 20000))),
|
||||||
],
|
],
|
||||||
resources: ['https://www.youtube.com/watch?v=dyAvbUvY_PU']),
|
resources: ['https://www.youtube.com/watch?v=dyAvbUvY_PU']),
|
||||||
ActivityModel(
|
ActivityModel(
|
||||||
@ -131,13 +131,13 @@ class SessionCard extends StatelessWidget {
|
|||||||
activityActionSet: Set(
|
activityActionSet: Set(
|
||||||
type: 'drop_set',
|
type: 'drop_set',
|
||||||
total: 3,
|
total: 3,
|
||||||
rest: 3000,
|
rest: 300000,
|
||||||
reps: Reps(
|
reps: Reps(
|
||||||
type: 'count',
|
type: 'count',
|
||||||
tempo: [2, 3, 5],
|
tempo: [2, 3, 5],
|
||||||
amounts: [5, 3, 2],
|
amounts: [5, 3, 2],
|
||||||
weights: [50, 70, 80],
|
weights: [50, 70, 80],
|
||||||
rest: 200))),
|
rest: 20000))),
|
||||||
],
|
],
|
||||||
resources: ['https://www.youtube.com/watch?v=dyAvbUvY_PU']),
|
resources: ['https://www.youtube.com/watch?v=dyAvbUvY_PU']),
|
||||||
],
|
],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user