reset timer and activity when complete

This commit is contained in:
Joshua Burman
2024-12-07 15:25:03 -05:00
parent f781001d3b
commit 0c0f596fbb
5 changed files with 93 additions and 244 deletions

View File

@ -44,7 +44,7 @@ class ActivityActionViewState extends State<ActivityActionView> {
? Theme.of(context).colorScheme.primaryContainer
: Theme.of(context).colorScheme.onPrimary,
child:
Text(textAlign: TextAlign.center, 'Set ${setNum + 1} ')),
Text(textAlign: TextAlign.center, '${setNum + 1}.${actionNum + 1} ')),
Expanded(
child: Ink(
padding: const EdgeInsets.all(15),

View File

@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:provider/provider.dart';
import 'package:sendtrain/classes/activity_action.dart';
import 'package:sendtrain/classes/media.dart';
@ -54,132 +55,65 @@ class _ActivityViewState extends State<ActivityView> {
style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
'Actions:')),
Padding(
padding: const EdgeInsets.only(left: 10, right: 10),
child: Card(
clipBehavior: Clip.antiAlias,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.only(topLeft: Radius.circular(10), topRight: Radius.circular(10)),
),
color: Theme.of(context).colorScheme.onPrimary,
child: Padding(
padding: const EdgeInsets.only(left: 0, right: 0),
child: Row(children: [
// LinearProgressIndicator(
// value: 0.5,
// minHeight: 100,
// color: Theme.of(context).colorScheme.error,
// semanticsLabel: 'Linear progress indicator',
// ),
// Expanded(
// flex: 1,
// child: Flex(direction: Axis.horizontal, children: [
// Consumer<ActivityTimerModel>(builder: (context, atm, child) {
// return IconButton(
// iconSize: 30,
// icon: atm.isActive()
// ? const Icon(Icons.pause_rounded)
// : const Icon(Icons.play_arrow_rounded),
// onPressed: () =>
// {atm.isActive() ? atm.pause : atm.start()});
// }),
// // IconButton(
// // // iconSize: 36,
// // icon: const Icon(Icons.skip_next_rounded),
// // onPressed: () {
// // atm.nextAction('manual');
// // })
// ])),
Ink(
width: 70,
color: Theme.of(context).colorScheme.primaryContainer,
child: Consumer<ActivityTimerModel>(
builder: (context, atm, child) {
return IconButton(
alignment: AlignmentDirectional.center,
iconSize: 30,
icon: atm.isActive
? const Icon(Icons.pause_rounded)
: const Icon(Icons.play_arrow_rounded),
onPressed: () =>
{atm.isActive ? atm.pause : atm.start()});
},
)),
Expanded(
flex: 2,
child: Consumer<ActivityTimerModel>(
builder: (context, atm, child) {
return Text(
style: const TextStyle(fontSize: 20),
textAlign: TextAlign.right,
'${atm.actionCount} ${atm.currentAction['type']}');
},
)),
Expanded(
flex: 1,
child: Padding(
padding: const EdgeInsets.only(right: 15),
child: Consumer<ActivityTimerModel>(
builder: (context, atm, child) {
return Text(
style: const TextStyle(fontSize: 15),
textAlign: TextAlign.right,
'${atm.currentAction['actionID']} | ${atm.totalActions()}');
// 'Set: ${atm.currentSet + 1}/${atm.totalSets}\nRep: ${atm.currentRep + 1}/${atm.totalReps}');
}))),
])))),
padding: const EdgeInsets.only(left: 10, right: 10),
child: Card(
clipBehavior: Clip.antiAlias,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(10),
topRight: Radius.circular(10)),
),
color: Theme.of(context).colorScheme.onPrimary,
child: Row(children: [
// LinearProgressIndicator(
// value: 0.5,
// minHeight: 100,
// color: Theme.of(context).colorScheme.error,
// semanticsLabel: 'Linear progress indicator',
// ),
Ink(
width: 70,
color: Theme.of(context).colorScheme.primaryContainer,
child: Consumer<ActivityTimerModel>(
builder: (context, atm, child) {
return IconButton(
alignment: AlignmentDirectional.center,
iconSize: 30,
icon: atm.isActive
? const Icon(Icons.pause_rounded)
: const Icon(Icons.play_arrow_rounded),
onPressed: () =>
{atm.isActive ? atm.pause : atm.start()});
},
)),
Expanded(
flex: 1,
child: Stack(alignment: Alignment.center, children: [
Container(
alignment: Alignment.center,
child: Consumer<ActivityTimerModel>(
builder: (context, atm, child) {
return Text(
style: const TextStyle(fontSize: 20),
textAlign: TextAlign.center,
'${atm.actionCount} ${atm.currentAction['type']}');
},
),
),
Container(
alignment: Alignment.centerRight,
padding: EdgeInsets.only(right: 10),
child: Consumer<ActivityTimerModel>(
builder: (context, atm, child) {
return Text(
style: const TextStyle(fontSize: 15),
textAlign: TextAlign.right,
'${atm.currentAction['actionID'] + 1} | ${atm.totalActions()}');
// 'Set: ${atm.currentSet + 1}/${atm.totalSets}\nRep: ${atm.currentRep + 1}/${atm.totalReps}');
})),
])),
]))),
ActivityActionView(action: activity.actions[0]),
// Container(
// height: MediaQuery.sizeOf(context).height * .07,
// color: Theme.of(context).colorScheme.primaryContainer,
// child: Row(children: [
// // LinearProgressIndicator(
// // value: 0.5,
// // minHeight: 100,
// // color: Theme.of(context).colorScheme.error,
// // semanticsLabel: 'Linear progress indicator',
// // ),
// Expanded(
// flex: 1,
// child: Flex(direction: Axis.horizontal, children: [
// Consumer<ActivityTimerModel>(builder: (context, atm, child) {
// return IconButton(
// iconSize: 30,
// icon: atm.isActive()
// ? const Icon(Icons.pause_rounded)
// : const Icon(Icons.play_arrow_rounded),
// onPressed: () =>
// {atm.isActive() ? atm.pause() : atm.start()});
// }),
// IconButton(
// iconSize: 36,
// icon: const Icon(Icons.skip_next_rounded),
// onPressed: () {
// atm.nextAction('manual');
// })
// ])),
// Expanded(
// flex: 1,
// child: Consumer<ActivityTimerModel>(
// builder: (context, atm, child) {
// return Text(
// style: const TextStyle(fontSize: 20),
// textAlign: TextAlign.center,
// '${atm.actionCount} ${atm.actionState()}');
// },
// )),
// Expanded(
// flex: 1,
// child: Padding(
// padding: const EdgeInsets.only(right: 15),
// child: Consumer<ActivityTimerModel>(
// builder: (context, atm, child) {
// return Text(
// style: const TextStyle(fontSize: 20),
// textAlign: TextAlign.right,
// '${atm.currentAction + 1}: ${atm.actionType}');
// // 'Set: ${atm.currentSet + 1}/${atm.totalSets}\nRep: ${atm.currentRep + 1}/${atm.totalReps}');
// }))),
// ]))
]);
}
}

View File

@ -131,13 +131,13 @@ class SessionCard extends StatelessWidget {
activityActionSet: Set(
type: 'alternating',
total: 5,
rest: 300000,
rest: 5000,
reps: Reps(
type: 'seconds',
tempo: [0],
amounts: [60, 60, 60, 60, 60],
amounts: [5, 5, 5, 5, 5],
weights: [80, 80, 80, 80, 80],
rest: 0))),
rest: 5000))),
],
resources: ['https://www.youtube.com/watch?v=dyAvbUvY_PU']),
],