WT1.1.23 fix changes

This commit is contained in:
bossanyit
2021-09-16 18:40:59 +02:00
parent d969a55458
commit 9c72df1d67
16 changed files with 524 additions and 157 deletions
-1
View File
@@ -2,7 +2,6 @@ import 'dart:collection';
import 'package:aitrainer_app/bloc/exercise_control/exercise_control_bloc.dart';
import 'package:aitrainer_app/bloc/timer/timer_bloc.dart';
import 'package:aitrainer_app/bloc/tutorial/tutorial_bloc.dart';
import 'package:aitrainer_app/library/custom_icon_icons.dart';
import 'package:aitrainer_app/util/app_language.dart';
import 'package:aitrainer_app/model/cache.dart';
+67 -9
View File
@@ -2,7 +2,9 @@ import 'dart:collection';
import 'package:aitrainer_app/bloc/exercise_log/exercise_log_bloc.dart';
import 'package:aitrainer_app/widgets/app_bar.dart';
import 'package:aitrainer_app/widgets/bottom_nav.dart';
import 'package:aitrainer_app/widgets/dialog_common.dart';
import 'package:aitrainer_app/widgets/dialog_premium.dart';
import 'package:badges/badges.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:intl/intl.dart';
@@ -193,16 +195,72 @@ class ExerciseLogPage extends StatelessWidget with Trans, Common {
)),
GestureDetector(
onTap: () => evaluation(exerciseRepository, exercise),
child: Image.asset(
"asset/image/kupa.png",
width: 35,
child: Badge(
elevation: 0,
padding: EdgeInsets.all(0),
position: BadgePosition.topStart(top: -25, start: -25),
animationDuration: Duration(milliseconds: 1500),
animationType: BadgeAnimationType.fade,
badgeColor: Colors.transparent,
showBadge: true,
badgeContent: IconButton(
iconSize: 36,
onPressed: () => showDialog(
context: context,
builder: (BuildContext context) {
return DialogCommon(
title: t("Premium function"),
descriptions: Cache().canTrial()
? t("This is a premium function, you can reach it outside of the trial period only with a valid subscription")
: t("This is a premium function, you can reach it only with a valid subscription"),
onCancel: () => Navigator.of(context).pop(),
onTap: () => Navigator.of(context).pop(),
text: '',
);
}),
icon: Icon(
Icons.star,
size: 14,
color: Colors.orange[400],
)),
child: Image.asset(
"asset/image/kupa.png",
width: 35,
))),
Badge(
elevation: 0,
padding: EdgeInsets.all(0),
position: BadgePosition.topStart(top: -18, start: -17),
animationDuration: Duration(milliseconds: 1500),
animationType: BadgeAnimationType.fade,
badgeColor: Colors.transparent,
showBadge: true,
badgeContent: IconButton(
iconSize: 36,
onPressed: () => showDialog(
context: context,
builder: (BuildContext context) {
return DialogCommon(
title: t("Premium function"),
descriptions: Cache().canTrial()
? t("This is a premium function, you can reach it outside of the trial period only with a valid subscription")
: t("This is a premium function, you can reach it only with a valid subscription"),
onCancel: () => Navigator.of(context).pop(),
onTap: () => Navigator.of(context).pop(),
text: '',
);
}),
icon: Icon(
Icons.star,
size: 14,
color: Colors.orange[400],
)),
child: IconButton(
icon: Icon(Icons.delete, color: Colors.black12),
onPressed: () {
confirmationDialog(exerciseLogBloc, exercise);
},
)),
IconButton(
icon: Icon(Icons.delete, color: Colors.black12),
onPressed: () {
confirmationDialog(exerciseLogBloc, exercise);
},
),
]),
)),
);
+202 -80
View File
@@ -6,8 +6,10 @@ 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_common.dart';
import 'package:aitrainer_app/widgets/dialog_html.dart';
import 'package:aitrainer_app/widgets/dialog_premium.dart';
import 'package:badges/badges.dart';
import 'package:flutter/services.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:aitrainer_app/util/trans.dart';
import 'package:aitrainer_app/widgets/app_bar.dart';
@@ -77,102 +79,187 @@ class _MyDevelopmentPage extends State<MyDevelopmentPage> with Trans {
onTap: () => this.callBackExerciseLog(exerciseRepository, customerRepository),
isLocked: false,
)),
ImageButton(
width: imageWidth,
textAlignment: Alignment.topLeft,
text: t("My Whole Body Development"),
style: GoogleFonts.robotoMono(
textStyle: TextStyle(
fontSize: 14, color: Colors.white, fontWeight: FontWeight.bold, backgroundColor: Colors.black54.withOpacity(0.4)),
),
image: "asset/image/testemfejl400x400.jpg",
left: 5,
onTap: () => {
if (Cache().userLoggedIn != null)
{
args['customerId'] = Cache().userLoggedIn!.customerId,
Navigator.of(context).pushNamed('mydevelopmentBodyPage', arguments: args)
}
else
{
showDialog(
Badge(
elevation: 0,
padding: EdgeInsets.all(0),
position: BadgePosition.topStart(top: -12, start: -12),
animationDuration: Duration(milliseconds: 1500),
animationType: BadgeAnimationType.fade,
badgeColor: Colors.transparent,
showBadge: Cache().hasPurchased,
badgeContent: IconButton(
iconSize: 36,
onPressed: () => showDialog(
context: context,
builder: (BuildContext context) {
return DialogCommon(
warning: true,
title: t("Warning"),
descriptions: t("Please log in"),
description2:
t("because only that way can we show you the personalized development diagrams and analysises"),
text: "OK",
onTap: () => Navigator.of(context).popAndPushNamed("login"),
onCancel: () => {
Navigator.of(context).pop(),
},
title: t("Premium function"),
descriptions: Cache().canTrial()
? t("This is a premium function, you can reach it outside of the trial period only with a valid subscription")
: t("This is a premium function, you can reach it only with a valid subscription"),
onCancel: () => Navigator.of(context).pop(),
onTap: () => Navigator.of(context).pop(),
text: '',
);
})
}
},
isLocked: true,
),
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,
fontSize: 16,
}),
icon: Icon(
Icons.star,
color: Colors.orange[600],
)),
child: ImageButton(
width: imageWidth,
textAlignment: Alignment.topLeft,
text: t("Development Of Muscles"),
text: t("My Whole Body Development"),
style: GoogleFonts.robotoMono(
textStyle: TextStyle(
fontSize: 14,
color: Colors.white,
fontWeight: FontWeight.bold,
backgroundColor: Colors.black54.withOpacity(0.4)),
),
image: "asset/image/testemfejl400x400.jpg",
left: 5,
onTap: () => {
if (Cache().userLoggedIn != null)
{
args['customerId'] = Cache().userLoggedIn!.customerId,
Navigator.of(context).pushNamed('mydevelopmentBodyPage', arguments: args)
}
else
{
showDialog(
context: context,
builder: (BuildContext context) {
return DialogCommon(
warning: true,
title: t("Warning"),
descriptions: t("Please log in"),
description2:
t("because only that way can we show you the personalized development diagrams and analysises"),
text: "OK",
onTap: () => Navigator.of(context).popAndPushNamed("login"),
onCancel: () => {
Navigator.of(context).pop(),
},
);
})
}
},
isLocked: true,
)),
Badge(
elevation: 0,
padding: EdgeInsets.all(0),
position: BadgePosition.topStart(top: -12, start: -12),
animationDuration: Duration(milliseconds: 1500),
animationType: BadgeAnimationType.fade,
badgeColor: Colors.transparent,
showBadge: Cache().hasPurchased,
badgeContent: IconButton(
iconSize: 36,
onPressed: () => showDialog(
context: context,
builder: (BuildContext context) {
return DialogCommon(
title: t("Premium function"),
descriptions: Cache().canTrial()
? t("This is a premium function, you can reach it outside of the trial period only with a valid subscription")
: t("This is a premium function, you can reach it only with a valid subscription"),
onCancel: () => Navigator.of(context).pop(),
onTap: () => Navigator.of(context).pop(),
text: '',
);
}),
icon: Icon(
Icons.star,
color: Colors.orange[600],
)),
child: 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,
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,
))),
Badge(
elevation: 0,
padding: EdgeInsets.all(0),
position: BadgePosition.topStart(top: -12, start: -12),
animationDuration: Duration(milliseconds: 1500),
animationType: BadgeAnimationType.fade,
badgeColor: Colors.transparent,
showBadge: Cache().hasPurchased,
badgeContent: IconButton(
iconSize: 36,
onPressed: () => showDialog(
context: context,
builder: (BuildContext context) {
return DialogCommon(
title: t("Premium function"),
descriptions: Cache().canTrial()
? t("This is a premium function, you can reach it outside of the trial period only with a valid subscription")
: t("This is a premium function, you can reach it only with a valid subscription"),
onCancel: () => Navigator.of(context).pop(),
onTap: () => Navigator.of(context).pop(),
text: '',
);
}),
icon: Icon(
Icons.star,
color: Colors.orange[600],
)),
child: ImageButton(
width: imageWidth,
left: 5,
textAlignment: Alignment.topLeft,
text: t("Predictions"),
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)},
image: "asset/image/predictions.jpg",
onTap: () => {
if (Cache().userLoggedIn != null)
{
Track().track(TrackingEvent.prediction),
showDialog(
context: context,
builder: (BuildContext context) {
return DialogPremium(
unlocked: Cache().hasPurchased,
unlockRound: 12,
function: "Predictions",
unlockedText: null,
onTap: () => {Navigator.of(context).pop()},
);
})
}
},
isLocked: true,
)),
ImageButton(
width: imageWidth,
left: 5,
textAlignment: Alignment.topLeft,
text: t("Predictions"),
style: GoogleFonts.robotoMono(
textStyle: TextStyle(
fontSize: 14,
color: Colors.white,
fontWeight: FontWeight.bold,
backgroundColor: Colors.black54.withOpacity(0.4))),
image: "asset/image/predictions.jpg",
onTap: () => {
if (Cache().userLoggedIn != null)
{
Track().track(TrackingEvent.prediction),
showDialog(
context: context,
builder: (BuildContext context) {
return DialogPremium(
unlocked: Cache().hasPurchased,
unlockRound: 12,
function: "Predictions",
unlockedText: null,
onTap: () => {Navigator.of(context).pop()},
);
})
}
},
isLocked: true,
),
//developmentWidget(imageWidth, "Development Size", "asset/image/predictions.jpg", TrackingEvent.my_size_development, args),
hiddenWidget(customerRepository, exerciseRepository),
]),
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
@@ -186,6 +273,41 @@ class _MyDevelopmentPage extends State<MyDevelopmentPage> with Trans {
bottomNavigationBar: BottomNavigator(bottomNavIndex: 1));
}
Widget developmentWidget(double imageWidth, String title, String imageUrl, TrackingEvent trackingEvent, LinkedHashMap args) {
return ImageButton(
width: imageWidth,
left: 5,
textAlignment: Alignment.topLeft,
text: t(title),
style: GoogleFonts.robotoMono(
textStyle:
TextStyle(fontSize: 14, color: Colors.white, fontWeight: FontWeight.bold, backgroundColor: Colors.black54.withOpacity(0.4))),
image: imageUrl,
onTap: () => {
if (Cache().userLoggedIn != null)
{
Track().track(trackingEvent),
SystemChrome.setPreferredOrientations([DeviceOrientation.landscapeLeft]),
Future.delayed(Duration(seconds: 400)),
Navigator.of(context).pushNamed('mydevelopmentSizesPage', arguments: args),
/* showDialog(
context: context,
builder: (BuildContext context) {
return DialogPremium(
unlocked: Cache().hasPurchased,
unlockRound: 12,
function: "Predictions",
unlockedText: null,
onTap: () => {Navigator.of(context).pop()},
);
}) */
}
},
isLocked: true,
);
}
Widget hiddenWidget(CustomerRepository customerRepository, ExerciseRepository exerciseRepository) {
final LinkedHashMap args = LinkedHashMap();
if (Cache().getTrainee() != null) {
+41 -12
View File
@@ -15,6 +15,7 @@ import 'package:aitrainer_app/widgets/dialog_common.dart';
import 'package:aitrainer_app/widgets/dialog_premium.dart';
import 'package:aitrainer_app/widgets/menu_image.dart';
import 'package:aitrainer_app/widgets/treeview_parent_widget.dart';
import 'package:badges/badges.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
@@ -186,20 +187,48 @@ class TrainingPlanActivatePage extends StatelessWidget with Trans {
listWidget.add(explanation);
plans.forEach((element) {
bool restricted = (!element.free);
listWidget.add(Container(
margin: const EdgeInsets.only(left: 4.0),
child: TreeViewChild(
startExpanded: false,
parent: TreeviewParentWidget(
text: element.nameTranslations[AppLanguage().appLocal.toString()] != null
? element.nameTranslations[AppLanguage().appLocal.toString()]!
: element.name,
fontSize: 18,
icon: Icon(Icons.list_sharp),
color: Colors.blue[800],
),
children: _getDays(element, bloc),
)));
child: Badge(
elevation: 0,
padding: EdgeInsets.all(0),
position: BadgePosition.topStart(top: -15, start: -18),
animationDuration: Duration(milliseconds: 1500),
animationType: BadgeAnimationType.fade,
badgeColor: Colors.transparent,
showBadge: restricted,
badgeContent: IconButton(
iconSize: 36,
onPressed: () => showDialog(
context: context,
builder: (BuildContext context) {
return DialogCommon(
title: t("Premium function"),
descriptions: Cache().canTrial()
? t("This is a premium function, you can reach it outside of the trial period only with a valid subscription")
: t("This is a premium function, you can reach it only with a valid subscription"),
onCancel: () => Navigator.of(context).pop(),
onTap: () => Navigator.of(context).pop(),
text: '',
);
}),
icon: Icon(
Icons.star,
color: Colors.orange[400],
)),
child: TreeViewChild(
startExpanded: false,
parent: TreeviewParentWidget(
text: element.nameTranslations[AppLanguage().appLocal.toString()] != null
? element.nameTranslations[AppLanguage().appLocal.toString()]!
: element.name,
fontSize: 18,
icon: Icon(Icons.list_sharp),
color: Colors.blue[800],
),
children: _getDays(element, bloc),
))));
});
return listWidget;
+3 -2
View File
@@ -21,7 +21,6 @@ class TrainingPlanExercise extends StatelessWidget with Trans {
final CustomerTrainingPlanDetails detail = args['customerTrainingPlanDetails'];
// ignore: close_sinks
final TrainingPlanBloc bloc = BlocProvider.of<TrainingPlanBloc>(context);
final bool isDropSet = detail.weight == -3;
setContext(context);
return Scaffold(
appBar: AppBarNav(depth: 1),
@@ -98,7 +97,9 @@ class TrainingPlanExercise extends StatelessWidget with Trans {
repeats: detail.repeats == -1 ? 99 : detail.repeats,
set: detail.set,
exerciseNr: detail.exercises.length + 1,
onUnitQuantityChanged: (value) => bloc.add(TrainingPlanWeightChange(weight: value, detail: detail)),
onUnitQuantityChanged: (value) => bloc.add(TrainingPlanWeightChangeRecalculate(weight: value, detail: detail)),
onUnitQuantityChangeUp: () => bloc.add(TrainingPlanWeightChangeUp(detail: detail)),
onUnitQuantityChangeDown: () => bloc.add(TrainingPlanWeightChangeDown(detail: detail)),
onQuantityChanged: (value) => bloc.add(TrainingPlanRepeatsChange(repeats: value.toInt(), detail: detail)),
exerciseTypeId: detail.exerciseType!.exerciseTypeId,
originalQuantity: originalQuantity,