WT1.1.10+5 bugfix
This commit is contained in:
@@ -85,6 +85,7 @@ class _ExerciseLogPage extends State<ExerciseLogPage> with Trans, Common {
|
||||
} else if (Cache().getTrainee() != null && customerId == Cache().getTrainee().customerId) {
|
||||
exerciseRepository.exerciseList = exerciseRepository.getExerciseListTrainee();
|
||||
}
|
||||
//print("ExerciseList ${exerciseRepository.exerciseList}");
|
||||
exerciseRepository.sortByDate();
|
||||
|
||||
List<Widget> listWidget = List();
|
||||
@@ -146,6 +147,7 @@ class _ExerciseLogPage extends State<ExerciseLogPage> with Trans, Common {
|
||||
origDate = exerciseDate;
|
||||
}
|
||||
});
|
||||
//print("ListExerices $listExercises");
|
||||
if (listExercises.length > 0) {
|
||||
listWidget.add(Container(
|
||||
margin: const EdgeInsets.only(left: 4.0),
|
||||
@@ -194,27 +196,12 @@ class _ExerciseLogPage extends State<ExerciseLogPage> with Trans, Common {
|
||||
exercise.summary == null ? "" : exercise.summary,
|
||||
style: TextStyle(fontSize: 12, color: Colors.blue[800]),
|
||||
)),
|
||||
Stack(
|
||||
children: [
|
||||
IconButton(
|
||||
iconSize: 36,
|
||||
icon: Icon(CustomIcon.heart_1, color: Colors.blue[800]),
|
||||
onPressed: () {
|
||||
evaluation(exerciseRepository, exercise);
|
||||
},
|
||||
),
|
||||
Cache().hasPurchased
|
||||
? Offstage()
|
||||
: GestureDetector(
|
||||
child: Image.asset(
|
||||
'asset/image/lock.png',
|
||||
height: 25,
|
||||
width: 25,
|
||||
),
|
||||
onTap: () {
|
||||
evaluation(exerciseRepository, exercise);
|
||||
}),
|
||||
],
|
||||
IconButton(
|
||||
iconSize: 36,
|
||||
icon: Icon(CustomIcon.heart_1, color: Colors.orange[800]),
|
||||
onPressed: () {
|
||||
evaluation(exerciseRepository, exercise);
|
||||
},
|
||||
),
|
||||
IconButton(
|
||||
icon: Icon(Icons.delete, color: Colors.black12),
|
||||
@@ -295,7 +282,25 @@ class _ExerciseLogPage extends State<ExerciseLogPage> with Trans, Common {
|
||||
),
|
||||
FlatButton(
|
||||
child: Text(t("Yes")),
|
||||
onPressed: () => {bloc.add(ExerciseLogDelete(exercise: exercise)), Navigator.pop(context)},
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
if (!Cache().hasPurchased) {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return DialogPremium(
|
||||
unlocked: Cache().hasPurchased,
|
||||
unlockRound: 1,
|
||||
unlockedText: t("Enjoy also this premium fetaure to delete mistyped old exercises."),
|
||||
function: "Delete Exercise",
|
||||
onTap: () => {Navigator.of(context).pop()},
|
||||
onCancel: () => {Navigator.of(context).pop()},
|
||||
);
|
||||
});
|
||||
} else {
|
||||
bloc.add(ExerciseLogDelete(exercise: exercise));
|
||||
}
|
||||
},
|
||||
)
|
||||
],
|
||||
));
|
||||
|
||||
@@ -3,6 +3,7 @@ import 'dart:collection';
|
||||
import 'package:aitrainer_app/bloc/exercise_new/exercise_new_bloc.dart';
|
||||
import 'package:aitrainer_app/bloc/menu/menu_bloc.dart';
|
||||
import 'package:aitrainer_app/bloc/test_set_execute/test_set_execute_bloc.dart';
|
||||
import 'package:aitrainer_app/library/custom_icon_icons.dart';
|
||||
import 'package:aitrainer_app/model/cache.dart';
|
||||
import 'package:aitrainer_app/model/exercise_ability.dart';
|
||||
import 'package:aitrainer_app/model/exercise_type.dart';
|
||||
@@ -20,6 +21,7 @@ import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_form_bloc/flutter_form_bloc.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:modal_progress_hud/modal_progress_hud.dart';
|
||||
|
||||
class ExerciseNewPage extends StatefulWidget {
|
||||
@@ -115,9 +117,18 @@ class _ExerciseNewPageState extends State<ExerciseNewPage> with Trans, Logging {
|
||||
exerciseBloc.add(ExerciseNewQuantityChange(quantity: double.parse(value)));
|
||||
},
|
||||
onUnitQuantityChanged: (value) => exerciseBloc.add(ExerciseNewQuantityUnitChange(quantity: double.parse(value))),
|
||||
onSubmit: () => confirmationDialog(exerciseBloc, menuBloc),
|
||||
//onSubmit: () => confirmationDialog(exerciseBloc, menuBloc),
|
||||
exerciseTypeId: exerciseType.exerciseTypeId,
|
||||
)),
|
||||
floatingActionButton: FloatingActionButton.extended(
|
||||
onPressed: () => save(exerciseBloc, menuBloc),
|
||||
backgroundColor: Colors.orange[800],
|
||||
icon: Icon(CustomIcon.save),
|
||||
label: Text(
|
||||
t("Save"),
|
||||
style: GoogleFonts.inter(fontWeight: FontWeight.bold, fontSize: 16),
|
||||
),
|
||||
),
|
||||
bottomNavigationBar: BottomBarMultipleExercises(
|
||||
isSet: false,
|
||||
exerciseTypeId: exerciseType.exerciseTypeId,
|
||||
@@ -125,7 +136,18 @@ class _ExerciseNewPageState extends State<ExerciseNewPage> with Trans, Logging {
|
||||
);
|
||||
}
|
||||
|
||||
void confirmationDialog(ExerciseNewBloc bloc, MenuBloc menuBloc) {
|
||||
void save(ExerciseNewBloc bloc, MenuBloc menuBloc) {
|
||||
// ignore: close_sinks
|
||||
final TestSetExecuteBloc executeBloc = BlocProvider.of<TestSetExecuteBloc>(context);
|
||||
|
||||
if (executeBloc != null && executeBloc.existsActivePlan() == true) {
|
||||
confirmationOverride(bloc);
|
||||
} else {
|
||||
confirmationSave(bloc, menuBloc);
|
||||
}
|
||||
}
|
||||
|
||||
void confirmationSave(ExerciseNewBloc bloc, MenuBloc menuBloc) {
|
||||
if (bloc.exerciseRepository.exercise.quantity == null) {
|
||||
return;
|
||||
}
|
||||
@@ -173,17 +195,49 @@ class _ExerciseNewPageState extends State<ExerciseNewPage> with Trans, Logging {
|
||||
),
|
||||
FlatButton(
|
||||
child: Text(t("Yes")),
|
||||
onPressed: () => {
|
||||
bloc.exerciseRepository.setCustomer(Cache().userLoggedIn),
|
||||
bloc.add(ExerciseNewSubmit()),
|
||||
Navigator.pop(context),
|
||||
if (executeBloc.existsActivePlan() == true)
|
||||
{
|
||||
executeBloc.add(TestSetExecuteExerciseFinished(
|
||||
exerciseTypeId: bloc.exerciseRepository.exerciseType.exerciseTypeId,
|
||||
quantity: bloc.exerciseRepository.exercise.quantity,
|
||||
unitQuantity: bloc.exerciseRepository.exercise.unitQuantity)),
|
||||
}
|
||||
onPressed: () {
|
||||
saveAll(bloc);
|
||||
if (executeBloc.existsActivePlan() == true) {
|
||||
executeBloc.add(TestSetExecuteExerciseFinished(
|
||||
exerciseTypeId: bloc.exerciseRepository.exerciseType.exerciseTypeId,
|
||||
quantity: bloc.exerciseRepository.exercise.quantity,
|
||||
unitQuantity: bloc.exerciseRepository.exercise.unitQuantity));
|
||||
}
|
||||
Navigator.pop(context);
|
||||
},
|
||||
)
|
||||
],
|
||||
));
|
||||
}
|
||||
|
||||
void saveAll(ExerciseNewBloc bloc) {
|
||||
bloc.exerciseRepository.setCustomer(Cache().userLoggedIn);
|
||||
bloc.add(ExerciseNewSubmit());
|
||||
}
|
||||
|
||||
void confirmationOverride(ExerciseNewBloc bloc) {
|
||||
// ignore: close_sinks
|
||||
final TestSetExecuteBloc executeBloc = BlocProvider.of<TestSetExecuteBloc>(context);
|
||||
showCupertinoDialog(
|
||||
useRootNavigator: true,
|
||||
context: context,
|
||||
builder: (_) => CupertinoAlertDialog(
|
||||
title: Text(t("You have an active Test Set!"), style: GoogleFonts.archivoBlack(fontSize: 20, color: Colors.red[800])),
|
||||
content: Column(children: [
|
||||
Divider(),
|
||||
Text(t("Do you want to override it?"), style: GoogleFonts.archivoBlack(fontSize: 16, color: Colors.blue[800])),
|
||||
]),
|
||||
actions: [
|
||||
FlatButton(
|
||||
child: Text(t("No"), style: GoogleFonts.archivoBlack(fontSize: 16, color: Colors.blue[800])),
|
||||
onPressed: () => Navigator.pop(context),
|
||||
),
|
||||
FlatButton(
|
||||
child: Text(t("Yes"), style: GoogleFonts.archivoBlack(fontSize: 16, color: Colors.red[800])),
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
executeBloc.add(TestSetExecuteDeleteAllActive());
|
||||
saveAll(bloc);
|
||||
},
|
||||
)
|
||||
],
|
||||
|
||||
@@ -6,6 +6,7 @@ import 'package:aitrainer_app/repository/exercise_repository.dart';
|
||||
import 'package:aitrainer_app/util/enums.dart';
|
||||
import 'package:aitrainer_app/util/track.dart';
|
||||
import 'package:aitrainer_app/widgets/dialog_premium.dart';
|
||||
import 'package:badges/badges.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:aitrainer_app/util/trans.dart';
|
||||
import 'package:aitrainer_app/widgets/app_bar.dart';
|
||||
@@ -29,6 +30,11 @@ class _MyDevelopmentPage extends State<MyDevelopmentPage> with Trans {
|
||||
double mediaWidth = MediaQuery.of(context).size.width;
|
||||
double imageWidth = (mediaWidth - 45) / 2;
|
||||
|
||||
bool showExerciseLogBadge = Cache().getBadges()["exerciseLog"] != null;
|
||||
int counterExerciseLogBadge = Cache().getBadges()["exerciseLog"] != null ? Cache().getBadges()["exerciseLog"] : 0;
|
||||
bool showMuscleDevelopmentBadge = Cache().getBadges()["muscleDevelopment"] != null;
|
||||
int counterMuscleDevelopmentBadge = Cache().getBadges()["muscleDevelopment"] != null ? Cache().getBadges()["muscleDevelopment"] : 0;
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBarNav(depth: 0),
|
||||
body: Container(
|
||||
@@ -43,21 +49,33 @@ class _MyDevelopmentPage extends State<MyDevelopmentPage> with Trans {
|
||||
child: CustomScrollView(scrollDirection: Axis.vertical, slivers: [
|
||||
SliverGrid(
|
||||
delegate: SliverChildListDelegate([
|
||||
ImageButton(
|
||||
width: imageWidth,
|
||||
textAlignment: Alignment.topCenter,
|
||||
text: t("My Exercise Logs"),
|
||||
style: GoogleFonts.robotoMono(
|
||||
textStyle: TextStyle(
|
||||
fontSize: 14,
|
||||
Badge(
|
||||
padding: EdgeInsets.all(8),
|
||||
position: BadgePosition.topEnd(top: -5, end: -3),
|
||||
animationDuration: Duration(milliseconds: 500),
|
||||
animationType: BadgeAnimationType.slide,
|
||||
badgeColor: Colors.red,
|
||||
showBadge: showExerciseLogBadge,
|
||||
badgeContent: Text(counterExerciseLogBadge.toString(),
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.bold,
|
||||
backgroundColor: Colors.black54.withOpacity(0.4))),
|
||||
image: "asset/image/edzesnaplom400400.jpg",
|
||||
left: 5,
|
||||
onTap: () => this.callBackExerciseLog(exerciseRepository, customerRepository),
|
||||
isLocked: false,
|
||||
),
|
||||
fontSize: 16,
|
||||
)),
|
||||
child: ImageButton(
|
||||
width: imageWidth,
|
||||
textAlignment: Alignment.topCenter,
|
||||
text: t("My Exercise Logs"),
|
||||
style: GoogleFonts.robotoMono(
|
||||
textStyle: TextStyle(
|
||||
fontSize: 14,
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.bold,
|
||||
backgroundColor: Colors.black54.withOpacity(0.4))),
|
||||
image: "asset/image/edzesnaplom400400.jpg",
|
||||
left: 5,
|
||||
onTap: () => this.callBackExerciseLog(exerciseRepository, customerRepository),
|
||||
isLocked: false,
|
||||
)),
|
||||
ImageButton(
|
||||
width: imageWidth,
|
||||
textAlignment: Alignment.topLeft,
|
||||
@@ -96,21 +114,33 @@ class _MyDevelopmentPage extends State<MyDevelopmentPage> with Trans {
|
||||
},
|
||||
isLocked: true,
|
||||
), */
|
||||
ImageButton(
|
||||
width: imageWidth,
|
||||
textAlignment: Alignment.topLeft,
|
||||
text: t("Development Of Muscles"),
|
||||
style: GoogleFonts.robotoMono(
|
||||
textStyle: TextStyle(
|
||||
fontSize: 14,
|
||||
Badge(
|
||||
padding: EdgeInsets.all(8),
|
||||
position: BadgePosition.topEnd(top: -5, end: -3),
|
||||
animationDuration: Duration(milliseconds: 500),
|
||||
animationType: BadgeAnimationType.slide,
|
||||
badgeColor: Colors.red,
|
||||
showBadge: showMuscleDevelopmentBadge,
|
||||
badgeContent: Text(counterMuscleDevelopmentBadge.toString(),
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.bold,
|
||||
backgroundColor: Colors.black54.withOpacity(0.4))),
|
||||
image: "asset/image/izomcsop400400.jpg",
|
||||
left: 5,
|
||||
onTap: () => {Navigator.of(context).pushNamed('mydevelopmentMusclePage', arguments: args)},
|
||||
isLocked: true,
|
||||
),
|
||||
fontSize: 16,
|
||||
)),
|
||||
child: ImageButton(
|
||||
width: imageWidth,
|
||||
textAlignment: Alignment.topLeft,
|
||||
text: t("Development Of Muscles"),
|
||||
style: GoogleFonts.robotoMono(
|
||||
textStyle: TextStyle(
|
||||
fontSize: 14,
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.bold,
|
||||
backgroundColor: Colors.black54.withOpacity(0.4))),
|
||||
image: "asset/image/izomcsop400400.jpg",
|
||||
left: 5,
|
||||
onTap: () => {Navigator.of(context).pushNamed('mydevelopmentMusclePage', arguments: args)},
|
||||
isLocked: true,
|
||||
)),
|
||||
ImageButton(
|
||||
width: imageWidth,
|
||||
left: 5,
|
||||
|
||||
@@ -86,6 +86,7 @@ class SettingsPage extends StatelessWidget with Trans {
|
||||
title: Container(),
|
||||
);
|
||||
}
|
||||
print("Live: ${Cache().liveServer}");
|
||||
return ListTile(
|
||||
leading: Icon(Icons.data_usage_sharp),
|
||||
subtitle: Text("For Test purpuses select Test-Server. After that please restart the the App"),
|
||||
|
||||
@@ -136,8 +136,8 @@ class TestSetEdit extends StatelessWidget with Trans {
|
||||
barrierDismissible: false,
|
||||
builder: (BuildContext context) {
|
||||
return DialogCommon(
|
||||
title: "Own Body",
|
||||
descriptions: t("execute these exercises with maximum repeats. Leave at least 3 min rest time between time"),
|
||||
title: bloc.templateNameTranslation,
|
||||
descriptions: bloc.templateDescription,
|
||||
text: "OK",
|
||||
onTap: () => {Navigator.of(context).pop()},
|
||||
onCancel: () => {Navigator.of(context).pop()},
|
||||
@@ -182,7 +182,9 @@ class TestSetEdit extends StatelessWidget with Trans {
|
||||
}
|
||||
|
||||
alternatives.forEach((element) {
|
||||
list.add(getImageStack(element, menuBloc, bloc));
|
||||
if (workoutTree.exerciseTypeId != element.exerciseTypeId) {
|
||||
list.add(getImageStack(element, menuBloc, bloc));
|
||||
}
|
||||
});
|
||||
|
||||
return list;
|
||||
|
||||
+28
-13
@@ -2,6 +2,7 @@ import 'dart:collection';
|
||||
|
||||
import 'package:aitrainer_app/bloc/test_set_execute/test_set_execute_bloc.dart';
|
||||
import 'package:aitrainer_app/bloc/test_set_new/test_set_new_bloc.dart';
|
||||
import 'package:aitrainer_app/library/custom_icon_icons.dart';
|
||||
import 'package:aitrainer_app/model/exercise_plan_detail.dart';
|
||||
import 'package:aitrainer_app/model/exercise_type.dart';
|
||||
import 'package:aitrainer_app/repository/exercise_repository.dart';
|
||||
@@ -11,6 +12,7 @@ import 'package:aitrainer_app/widgets/bottom_bar_multiple_exercises.dart';
|
||||
import 'package:aitrainer_app/widgets/exercise_save.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:modal_progress_hud/modal_progress_hud.dart';
|
||||
|
||||
// ignore: must_be_immutable
|
||||
@@ -67,6 +69,18 @@ class TestSetNew extends StatelessWidget with Trans {
|
||||
);
|
||||
}),
|
||||
)),
|
||||
floatingActionButton: FloatingActionButton.extended(
|
||||
onPressed: () => {
|
||||
Navigator.of(context).pop(),
|
||||
bloc.add(TestSetNewSubmit()),
|
||||
},
|
||||
backgroundColor: Colors.orange[800],
|
||||
icon: Icon(CustomIcon.save),
|
||||
label: Text(
|
||||
t("Save"),
|
||||
style: GoogleFonts.inter(fontWeight: FontWeight.bold, fontSize: 16),
|
||||
),
|
||||
),
|
||||
bottomNavigationBar: BottomBarMultipleExercises(
|
||||
isSet: executeBloc.miniTestSet == true,
|
||||
exerciseTypeId: exerciseType.exerciseTypeId,
|
||||
@@ -76,20 +90,21 @@ class TestSetNew extends StatelessWidget with Trans {
|
||||
|
||||
Widget getExercises(TestSetNewBloc bloc) {
|
||||
return ExerciseSave(
|
||||
exerciseName: bloc.exerciseType.nameTranslation,
|
||||
exerciseDescription: bloc.exerciseType.descriptionTranslation,
|
||||
exerciseTask: t("Please take a relative bigger weight and repeat 12-20 times"),
|
||||
unit: bloc.exerciseType.unit,
|
||||
unitQuantityUnit: bloc.exerciseType.unitQuantityUnit,
|
||||
hasUnitQuantity: bloc.exerciseType.unitQuantityUnit != null,
|
||||
onQuantityChanged: (value) {
|
||||
bloc.add(TestSetNewChangeQuantity(quantity: double.parse(value)));
|
||||
},
|
||||
onUnitQuantityChanged: (value) => bloc.add(TestSetNewChangeQuantityUnit(quantity: double.parse(value))),
|
||||
exerciseTypeId: bloc.exerciseType.exerciseTypeId,
|
||||
onSubmit: () {
|
||||
exerciseName: bloc.exerciseType.nameTranslation,
|
||||
exerciseDescription: bloc.exerciseType.descriptionTranslation,
|
||||
exerciseTask: t("Please take a relative bigger weight and repeat 12-20 times"),
|
||||
unit: bloc.exerciseType.unit,
|
||||
unitQuantityUnit: bloc.exerciseType.unitQuantityUnit,
|
||||
hasUnitQuantity: bloc.exerciseType.unitQuantityUnit != null,
|
||||
onQuantityChanged: (value) {
|
||||
bloc.add(TestSetNewChangeQuantity(quantity: double.parse(value)));
|
||||
},
|
||||
onUnitQuantityChanged: (value) => bloc.add(TestSetNewChangeQuantityUnit(quantity: double.parse(value))),
|
||||
exerciseTypeId: bloc.exerciseType.exerciseTypeId,
|
||||
/* onSubmit: () {
|
||||
Navigator.of(context).pop();
|
||||
bloc.add(TestSetNewSubmit());
|
||||
});
|
||||
} */
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user