alternating timer types
This commit is contained in:
@ -9,38 +9,18 @@ import 'package:sendtrain/widgets/action_card.dart';
|
||||
|
||||
class ActivityActionView extends StatefulWidget {
|
||||
ActivityActionView({super.key, required this.action});
|
||||
|
||||
ActivityAction action;
|
||||
// ActivityTimerModel activityTimerModel;
|
||||
// get incrementActivity => ActivityActionViewState().incrementActivity();
|
||||
|
||||
@override
|
||||
State<ActivityActionView> createState() => ActivityActionViewState();
|
||||
// void incrementActivity() => _ActivityActionViewState().incrementActivity();
|
||||
}
|
||||
|
||||
class ActivityActionViewState extends State<ActivityActionView> {
|
||||
int _index = 0;
|
||||
int _currentAction = 0;
|
||||
// int _actionCount = 0;
|
||||
// int _currentState = "Active"
|
||||
|
||||
// void incrementActivity(int actionNum) {
|
||||
// setState(() {
|
||||
// atm.setAction(actionNum);
|
||||
// });
|
||||
// }
|
||||
|
||||
// void setActivity(int currentAction) {
|
||||
// setState(() {
|
||||
// widget.atm.setAction(currentAction);
|
||||
// });
|
||||
// }
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
int actionCount = 0;
|
||||
ActivityTimerModel atm = Provider.of<ActivityTimerModel>(context, listen: true);
|
||||
ActivityTimerModel atm =
|
||||
Provider.of<ActivityTimerModel>(context, listen: true);
|
||||
|
||||
return Expanded(
|
||||
child: ListView.builder(
|
||||
@ -56,13 +36,15 @@ class ActivityActionViewState extends State<ActivityActionView> {
|
||||
|
||||
contents.add(Card(
|
||||
elevation: 0.5,
|
||||
// surfaceTintColor: actionCount == _index ? Colors.white : ,
|
||||
shadowColor: Theme.of(context).colorScheme.shadow,
|
||||
color: currentAction == atm.currentAction
|
||||
? Theme.of(context).colorScheme.secondaryContainer
|
||||
: Theme.of(context).colorScheme.onSecondary,
|
||||
clipBehavior: Clip.antiAlias,
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
log('we tappn');
|
||||
setState(() {
|
||||
atm.setAction(currentAction, index, "rep");
|
||||
atm.setAction(currentAction, 'manual');
|
||||
});
|
||||
},
|
||||
child: Row(children: [
|
||||
@ -70,8 +52,8 @@ class ActivityActionViewState extends State<ActivityActionView> {
|
||||
return Ink(
|
||||
padding: const EdgeInsets.all(15),
|
||||
color: currentAction == atm.currentAction
|
||||
? const Color.fromARGB(255, 49, 154, 52)
|
||||
: const Color(0xff3A5FB6),
|
||||
? Theme.of(context).colorScheme.onPrimary
|
||||
: Theme.of(context).colorScheme.primaryContainer,
|
||||
child: Text('Set: ${index + 1} '));
|
||||
}),
|
||||
Expanded(
|
||||
@ -82,11 +64,14 @@ class ActivityActionViewState extends State<ActivityActionView> {
|
||||
actionCount++;
|
||||
|
||||
contents.add(Card(
|
||||
color: currentAction + 1 == atm.currentAction
|
||||
? Theme.of(context).colorScheme.secondaryContainer
|
||||
: Theme.of(context).colorScheme.onSecondary,
|
||||
clipBehavior: Clip.antiAlias,
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
setState(() {
|
||||
atm.setAction(currentAction + 1, index, "rest");
|
||||
atm.setAction(currentAction + 1, 'manual');
|
||||
});
|
||||
},
|
||||
child: Row(children: [
|
||||
@ -94,8 +79,8 @@ class ActivityActionViewState extends State<ActivityActionView> {
|
||||
return Ink(
|
||||
padding: const EdgeInsets.all(15),
|
||||
color: currentAction + 1 == atm.currentAction
|
||||
? const Color.fromARGB(255, 49, 154, 52)
|
||||
: const Color(0xff3A5FB6),
|
||||
? Theme.of(context).colorScheme.onPrimary
|
||||
: Theme.of(context).colorScheme.primaryContainer,
|
||||
child: Text('Set: ${index + 1} '));
|
||||
}),
|
||||
Expanded(
|
||||
|
@ -21,12 +21,8 @@ class _ActivityViewState extends State<ActivityView> {
|
||||
ActivityModel activity = widget.activity;
|
||||
ActivityTimerModel atm =
|
||||
Provider.of<ActivityTimerModel>(context, listen: false);
|
||||
// ActivityActionView activityActionView =
|
||||
// ActivityActionView(action: activity.actions[0]);
|
||||
|
||||
if (atm.active == false) {
|
||||
atm.setupTimer(activity);
|
||||
}
|
||||
atm.setup(activity);
|
||||
|
||||
return Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
|
||||
AppBar(
|
||||
@ -60,23 +56,31 @@ class _ActivityViewState extends State<ActivityView> {
|
||||
ActivityActionView(action: activity.actions[0]),
|
||||
Container(
|
||||
height: MediaQuery.sizeOf(context).height * .07,
|
||||
color:
|
||||
ThemeData.dark(useMaterial3: true).colorScheme.primaryContainer,
|
||||
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: [
|
||||
IconButton(
|
||||
iconSize: 30,
|
||||
icon: const Icon(Icons.play_arrow_rounded),
|
||||
onPressed: () => {
|
||||
atm.startTimer()
|
||||
}),
|
||||
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.incrementAction();
|
||||
atm.nextAction('manual');
|
||||
})
|
||||
])),
|
||||
Expanded(
|
||||
@ -96,9 +100,10 @@ class _ActivityViewState extends State<ActivityView> {
|
||||
child: Consumer<ActivityTimerModel>(
|
||||
builder: (context, atm, child) {
|
||||
return Text(
|
||||
style: const TextStyle(fontSize: 15),
|
||||
style: const TextStyle(fontSize: 20),
|
||||
textAlign: TextAlign.right,
|
||||
'Set: ${atm.currentSet + 1}/${atm.totalSets}\nRep: ${atm.currentRep + 1}/${atm.totalReps}');
|
||||
"${atm.actionType}");
|
||||
// 'Set: ${atm.currentSet + 1}/${atm.totalSets}\nRep: ${atm.currentRep + 1}/${atm.totalReps}');
|
||||
}))),
|
||||
]))
|
||||
]);
|
||||
|
@ -67,7 +67,7 @@ class SessionCard extends StatelessWidget {
|
||||
],
|
||||
resources: ['https://www.youtube.com/watch?v=bLz0xp1PEm4']),
|
||||
ActivityModel(
|
||||
id: 1,
|
||||
id: 2,
|
||||
title: 'Projecting',
|
||||
type: 'fundamental',
|
||||
categories: ['technique', 'conditioning'],
|
||||
@ -104,7 +104,7 @@ class SessionCard extends StatelessWidget {
|
||||
],
|
||||
resources: ['https://www.youtube.com/watch?v=dyAvbUvY_PU']),
|
||||
ActivityModel(
|
||||
id: 1,
|
||||
id: 3,
|
||||
title: 'Weighted Pull Ups',
|
||||
type: 'fundamental',
|
||||
categories: ['Strength', 'Power'],
|
||||
|
Reference in New Issue
Block a user