WT 1.1.24+7 traning plan fixes
This commit is contained in:
@@ -110,7 +110,7 @@ class TrainingPlanBloc extends Bloc<TrainingPlanEvent, TrainingPlanState> {
|
||||
} else if (event is TrainingPlanWeightChangeRecalculate) {
|
||||
yield TrainingPlanExerciseLoading();
|
||||
|
||||
if (event.detail.baseOneRepMax > 0) {
|
||||
if (event.detail.baseOneRepMax > 0 && event.detail.repeats != -1) {
|
||||
if (_myTrainingPlan == null) {
|
||||
setTrainingPlanFromCache();
|
||||
}
|
||||
@@ -642,7 +642,7 @@ class TrainingPlanBloc extends Bloc<TrainingPlanEvent, TrainingPlanState> {
|
||||
final String day = dayNames[this.activeDayIndex];
|
||||
CustomerTrainingPlanDetails? prev;
|
||||
for (var detail in _myPlan!.days[day]!) {
|
||||
print("Offset detail $detail");
|
||||
//print("Offset detail $detail");
|
||||
if (detail.state == ExercisePlanDetailState.inProgress || detail.state == ExercisePlanDetailState.start) {
|
||||
prev = detail;
|
||||
break;
|
||||
@@ -818,7 +818,7 @@ class TrainingPlanBloc extends Bloc<TrainingPlanEvent, TrainingPlanState> {
|
||||
allFinished =
|
||||
allFinished && (listDetail.exercises.length >= listDetail.set! || listDetail.state.equalsTo(ExercisePlanDetailState.skipped));
|
||||
}
|
||||
print("All finished: $allFinished for ${detail.exerciseTypeId}");
|
||||
//print("All finished: $allFinished for ${detail.exerciseTypeId}");
|
||||
return allFinished;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ class Customer {
|
||||
DateTime? trialDate;
|
||||
String? firebaseRegToken;
|
||||
String? lang;
|
||||
int? lifeLong;
|
||||
|
||||
LinkedHashMap<String, CustomerProperty> properties = LinkedHashMap();
|
||||
|
||||
@@ -67,6 +68,7 @@ class Customer {
|
||||
this.fitnessLevel = json['fitnessLevel'];
|
||||
this.goal = json['goal'];
|
||||
this.admin = json['admin'];
|
||||
this.lifeLong = json['lifeLong'];
|
||||
|
||||
this.trainer = json['trainer'];
|
||||
this.firebaseUid = json['firebaseUid'];
|
||||
@@ -106,6 +108,7 @@ class Customer {
|
||||
"trialDate": this.trialDate == null ? null : DateFormat('yyyy-MM-dd HH:mm:ss').format(this.trialDate!),
|
||||
"firebaseRegToken": this.firebaseRegToken,
|
||||
"lang": this.lang,
|
||||
"lifeLong": this.lifeLong,
|
||||
};
|
||||
|
||||
@override
|
||||
|
||||
@@ -83,6 +83,7 @@ class TrainingPlanRepository {
|
||||
detail.parallel = elem.parallel;
|
||||
detail.restingTime = elem.restingTime;
|
||||
detail.exerciseType = Cache().getExerciseTypeById(detail.exerciseTypeId!);
|
||||
detail.alternatives = Common.getExerciseTypeAlternatives(detail.exerciseTypeId);
|
||||
if (elem.weight == -1) {
|
||||
if (detail.exerciseType!.unitQuantityUnit != null) {
|
||||
detail = getCalculatedWeightRepeats(elem.exerciseTypeId, detail);
|
||||
|
||||
@@ -48,7 +48,7 @@ class RevenueCatPurchases with Logging {
|
||||
}
|
||||
bool inTrial = Cache().userLoggedIn!.trialDate != null && DateTime.now().difference(Cache().userLoggedIn!.trialDate!).inDays < 10;
|
||||
log("Trial mode: $inTrial date: ${Cache().userLoggedIn!.trialDate}");
|
||||
if (Cache().userLoggedIn!.admin == 1 || inTrial) {
|
||||
if (Cache().userLoggedIn!.admin == 1 || inTrial || Cache().userLoggedIn!.lifeLong == 1) {
|
||||
Cache().hasPurchased = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user