WT 1.1.24+7 traning plan fixes

This commit is contained in:
bossanyit
2021-11-08 21:48:55 +01:00
parent 4c5aff91db
commit 0496f96da6
13 changed files with 295 additions and 256 deletions
+16 -15
View File
@@ -198,12 +198,12 @@ class ExerciseLogPage extends StatelessWidget with Trans, Common {
child: Badge(
elevation: 0,
padding: EdgeInsets.all(0),
position: BadgePosition.topStart(top: -25, start: -25),
position: BadgePosition.topStart(top: -5, start: -10),
animationDuration: Duration(milliseconds: 1500),
animationType: BadgeAnimationType.fade,
badgeColor: Colors.transparent,
showBadge: true,
badgeContent: IconButton(
badgeContent: /* IconButton(
iconSize: 36,
onPressed: () => showDialog(
context: context,
@@ -218,11 +218,12 @@ class ExerciseLogPage extends StatelessWidget with Trans, Common {
text: '',
);
}),
icon: Icon(
Icons.star,
size: 14,
color: Colors.orange[400],
)),
icon: */
Icon(
Icons.star,
size: 14,
color: Colors.orange[400],
),
child: Image.asset(
"asset/image/kupa.png",
width: 35,
@@ -230,12 +231,12 @@ class ExerciseLogPage extends StatelessWidget with Trans, Common {
Badge(
elevation: 0,
padding: EdgeInsets.all(0),
position: BadgePosition.topStart(top: -18, start: -17),
position: BadgePosition.topStart(top: 2, start: 5),
animationDuration: Duration(milliseconds: 1500),
animationType: BadgeAnimationType.fade,
badgeColor: Colors.transparent,
showBadge: true,
badgeContent: IconButton(
badgeContent: /* Icon(
iconSize: 36,
onPressed: () => showDialog(
context: context,
@@ -249,12 +250,12 @@ class ExerciseLogPage extends StatelessWidget with Trans, Common {
onTap: () => Navigator.of(context).pop(),
text: '',
);
}),
icon: Icon(
Icons.star,
size: 14,
color: Colors.orange[400],
)),
}), */
Icon(
Icons.star,
size: 14,
color: Colors.orange[400],
),
child: IconButton(
icon: Icon(Icons.delete, color: Colors.black12),
onPressed: () {
+141 -119
View File
@@ -1,5 +1,5 @@
import 'dart:collection';
import 'dart:math' show pi;
import 'package:aitrainer_app/bloc/training_plan/training_plan_bloc.dart';
import 'package:aitrainer_app/library/custom_icon_icons.dart';
import 'package:aitrainer_app/model/customer_training_plan_details.dart';
@@ -9,6 +9,7 @@ import 'package:aitrainer_app/util/trans.dart';
import 'package:aitrainer_app/widgets/app_bar.dart';
import 'package:aitrainer_app/widgets/dialog_common.dart';
import 'package:aitrainer_app/widgets/dialog_html.dart';
import 'package:aitrainer_app/widgets/menu_image.dart';
import 'package:badges/badges.dart';
import 'package:extended_tabs/extended_tabs.dart';
@@ -510,131 +511,152 @@ class ExerciseTile extends StatelessWidget with Trans {
final CustomerTrainingPlanDetails? next = bloc.getNext();
final bool noFilter = next != null && next.exerciseTypeId == detail.exerciseTypeId;
final bool done = detail.state == ExercisePlanDetailState.finished;
final bool done = bloc.isAllDetailsSameExerciseFinished(detail); //detail.state == ExercisePlanDetailState.finished;
final int step = bloc.getStep(detail); //detail.exercises.length;
final bool buddyWarning = detail.exerciseType == null ? false : detail.exerciseType!.buddyWarning;
final bool hasAlternative = false; //detail.alternatives.length > 0;
return Container(
child: Stack(alignment: Alignment.bottomLeft, children: [
Badge(
elevation: 0,
padding: EdgeInsets.all(0),
position: BadgePosition.topEnd(top: 5, end: 5),
animationDuration: Duration(milliseconds: 1500),
animationType: BadgeAnimationType.fade,
badgeColor: Colors.transparent,
showBadge: noFilter || done,
badgeContent: IconButton(
iconSize: 40,
onPressed: () => !done ? skip() : {},
icon: Icon(
done ? CustomIcon.ok_circled : Icons.cancel,
color: done ? Colors.green[600] : Colors.red[600],
)),
child: Badge(
elevation: 0,
padding: EdgeInsets.all(0),
position: BadgePosition.topStart(top: 5, start: 5),
animationDuration: Duration(milliseconds: 1000),
animationType: BadgeAnimationType.scale,
badgeColor: Colors.transparent,
showBadge: true,
badgeContent: IconButton(
iconSize: 36,
onPressed: () => showDialog(
context: context,
builder: (BuildContext context) {
return DialogHTML(
title: detail.exerciseType!.nameTranslation,
htmlData: '<p>' + detail.exerciseType!.descriptionTranslation + '</p>');
}),
icon: Icon(
Icons.info_outline,
color: Colors.yellow[200],
)),
child: Badge(
elevation: 0,
padding: EdgeInsets.all(0),
position: BadgePosition.topEnd(top: 65, end: 1),
animationDuration: Duration(milliseconds: 500),
animationType: BadgeAnimationType.fade,
badgeColor: Colors.transparent,
showBadge: buddyWarning,
badgeContent: IconButton(
iconSize: 50,
onPressed: () => showDialog(
context: context,
builder: (BuildContext context) {
return DialogCommon(
warning: true,
text: "Warning",
descriptions: t("Attention!"),
description2: t("The safe and exact execution of this exercise you need a training buddy or a trainer"),
description3: t("Execution at your own risk!"),
onTap: () => Navigator.of(context).pop(),
onCancel: () => Navigator.of(context).pop(),
title: t('Training Buddy'),
);
}),
icon: Icon(
CustomIcon.exclamation_circle,
color: Colors.red[800],
)),
child: Column(children: [
MenuImage(
imageName: bloc.getActualImageName(detail.exerciseType!.exerciseTypeId),
workoutTreeId: bloc.getActualWorkoutTreeId(detail.exerciseType!.exerciseTypeId)!,
radius: 0,
filter: !noFilter,
),
Container(
padding: EdgeInsets.only(left: 20, top: 10, bottom: 0),
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage('asset/image/WT_zold.jpg'),
fit: BoxFit.cover,
alignment: Alignment.center,
),
child: Stack(alignment: Alignment.centerRight, children: [
Stack(alignment: Alignment.centerLeft, children: [
Stack(alignment: Alignment.bottomLeft, children: [
Badge(
elevation: 0,
padding: EdgeInsets.all(0),
position: BadgePosition.topEnd(top: 5, end: 5),
animationDuration: Duration(milliseconds: 1500),
animationType: BadgeAnimationType.fade,
badgeColor: Colors.transparent,
showBadge: noFilter || done,
badgeContent: IconButton(
iconSize: 40,
onPressed: () => !done ? skip() : {},
icon: Icon(
done ? CustomIcon.ok_circled : Icons.cancel,
color: done ? Colors.green[600] : Colors.red[600],
)),
child: Badge(
elevation: 0,
padding: EdgeInsets.all(0),
position: BadgePosition.topStart(top: 5, start: 5),
animationDuration: Duration(milliseconds: 1000),
animationType: BadgeAnimationType.scale,
badgeColor: Colors.transparent,
showBadge: true,
badgeContent: IconButton(
iconSize: 36,
onPressed: () => showDialog(
context: context,
builder: (BuildContext context) {
return DialogHTML(
title: detail.exerciseType!.nameTranslation,
htmlData: '<p>' + detail.exerciseType!.descriptionTranslation + '</p>');
}),
icon: Icon(
Icons.info_outline,
color: Colors.yellow[200],
)),
child: Badge(
elevation: 0,
padding: EdgeInsets.all(0),
position: BadgePosition.topEnd(top: 65, end: 1),
animationDuration: Duration(milliseconds: 500),
animationType: BadgeAnimationType.fade,
badgeColor: Colors.transparent,
showBadge: buddyWarning,
badgeContent: IconButton(
iconSize: 50,
onPressed: () => showDialog(
context: context,
builder: (BuildContext context) {
return DialogCommon(
warning: true,
text: "Warning",
descriptions: t("Attention!"),
description2: t("The safe and exact execution of this exercise you need a training buddy or a trainer"),
description3: t("Execution at your own risk!"),
onTap: () => Navigator.of(context).pop(),
onCancel: () => Navigator.of(context).pop(),
title: t('Training Buddy'),
);
}),
icon: Icon(
CustomIcon.exclamation_circle,
color: Colors.red[800],
)),
child: Column(children: [
MenuImage(
imageName: bloc.getActualImageName(detail.exerciseType!.exerciseTypeId),
workoutTreeId: bloc.getActualWorkoutTreeId(detail.exerciseType!.exerciseTypeId)!,
radius: 0,
filter: !noFilter,
),
foregroundDecoration: !noFilter
? BoxDecoration(
color: Colors.black38,
backgroundBlendMode: BlendMode.darken,
)
: null,
height: 80,
width: double.infinity,
child: getExerciseQuantities(detail, step, noFilter),
)
])))),
Container(
padding: EdgeInsets.only(left: 15, bottom: 80, right: 15),
width: double.infinity,
color: Colors.transparent,
child: Text(
detail.exerciseType!.nameTranslation,
maxLines: 3,
style: GoogleFonts.archivoBlack(
color: noFilter ? Colors.white : Colors.grey,
fontSize: 36,
height: 1.1,
shadows: <Shadow>[
Shadow(
offset: Offset(16.0, 16.0),
blurRadius: 16.0,
color: Colors.black54,
),
Shadow(
offset: Offset(16.0, 16.0),
blurRadius: 16.0,
color: Colors.black54,
),
],
Container(
padding: EdgeInsets.only(left: 20, top: 10, bottom: 0),
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage('asset/image/WT_zold.jpg'),
fit: BoxFit.cover,
alignment: Alignment.center,
),
),
foregroundDecoration: !noFilter
? BoxDecoration(
color: Colors.black38,
backgroundBlendMode: BlendMode.darken,
)
: null,
height: 80,
width: double.infinity,
child: getExerciseQuantities(detail, step, noFilter),
)
])))),
Container(
padding: EdgeInsets.only(left: 15, bottom: 80, right: 15),
width: double.infinity,
color: Colors.transparent,
child: Text(
detail.exerciseType!.nameTranslation,
maxLines: 3,
style: GoogleFonts.archivoBlack(
color: noFilter ? Colors.white : Colors.grey,
fontSize: 36,
height: 1.1,
shadows: <Shadow>[
Shadow(
offset: Offset(16.0, 16.0),
blurRadius: 16.0,
color: Colors.black54,
),
Shadow(
offset: Offset(16.0, 16.0),
blurRadius: 16.0,
color: Colors.black54,
),
],
),
),
),
),
]),
hasAlternative
? Image.asset(
'asset/image/alternatives_arrow.png',
height: 100,
width: 100,
)
: Offstage(),
]),
);
hasAlternative
? Transform.rotate(
angle: pi,
alignment: Alignment.center,
child: Image.asset(
'asset/image/alternatives_arrow.png',
height: 100,
width: 100,
),
)
: Offstage(),
]));
}
void skip() {