with Trans {
- GestureRecognizer? _tapRecognizer;
-
- @override
- void initState() {
- _tapRecognizer = TapGestureRecognizer()..onTap = _onPlusMinusWeight;
- super.initState();
- }
-
- @override
- void dispose() {
- if (_tapRecognizer != null) {
- _tapRecognizer!.dispose();
- }
- super.dispose();
- }
-
- void _onPlusMinusWeight() {
- showDialog(
- context: context,
- builder: (BuildContext context) {
- return WeightControl(
- initialValue: widget.detail.weight != null ? widget.detail.weight! : 30,
- onTap: (value) => widget.bloc.add(TrainingPlanWeightChangeRecalculate(detail: widget.detail, weight: value)),
- );
- });
- }
-
- Widget getIndicator(ExercisePlanDetailState state) {
- CustomerTrainingPlanDetails? next = widget.bloc.getNext();
- bool actual = false;
- if (next != null) {
- if (next.exerciseTypeId == widget.detail.exerciseTypeId) {
- actual = true;
- }
- }
- if (state.equalsTo(ExercisePlanDetailState.inProgress)) {
- return ClipRRect(
- borderRadius: BorderRadius.circular(24.0),
- child: Container(
- color: actual ? Colors.green : Colors.orange,
- child: Icon(
- CustomIcon.calendar_2,
- size: 28,
- color: Colors.white,
- )));
- } else if (state.equalsTo(ExercisePlanDetailState.finished)) {
- return ClipRRect(
- borderRadius: BorderRadius.circular(24.0),
- child: Container(
- color: Colors.white,
- child: Icon(
- CustomIcon.ok_circled,
- size: 40,
- color: Colors.green,
- )));
- } else if (state.equalsTo(ExercisePlanDetailState.skipped)) {
- return ClipRRect(
- borderRadius: BorderRadius.circular(24.0),
- child: Container(
- color: Colors.white,
- child: Icon(
- CustomIcon.stop_1,
- size: 40,
- color: Colors.grey,
- )));
- } else if (state.equalsTo(ExercisePlanDetailState.extra)) {
- return ClipRRect(
- borderRadius: BorderRadius.circular(24.0),
- child: Container(
- color: Colors.white,
- child: Icon(
- CustomIcon.stopwatch_20,
- size: 40,
- color: Colors.blue[800],
- )));
- } else {
- return Image.asset(
- "asset/image/pict_reps_volumen_db.png",
- );
- }
- }
-
- @override
- Widget build(BuildContext context) {
- setContext(context);
- final ExercisePlanDetailState state = widget.detail.state;
- final bool done = state.equalsTo(ExercisePlanDetailState.finished) || state.equalsTo(ExercisePlanDetailState.skipped);
- final String countSerie = widget.detail.set.toString();
- final String step = (widget.detail.exercises.length).toString();
- String weight = widget.detail.weight != null ? widget.detail.weight!.toStringAsFixed(1) : "-";
- bool isDrop = false;
- if (widget.detail.weight == -3) {
- weight = "DROP";
- isDrop = true;
- }
- String restingTime = widget.detail.restingTime == null ? "" : widget.detail.restingTime!.toStringAsFixed(0);
- bool isTest = false;
- if (widget.detail.weight != null && widget.detail.weight! == -1) {
- weight = "TEST";
- isTest = true;
- }
- String repeats = widget.detail.repeats!.toString();
- if (widget.detail.repeats! == -1) {
- repeats = t("MAX");
- }
- final bool extraExercise = widget.detail.exerciseType!.name == "Warming Up" || widget.detail.exerciseType!.name == "Stretching";
-
- bool buddyWarning = widget.detail.exerciseType == null ? false : widget.detail.exerciseType!.buddyWarning;
- setContext(context);
- return Container(
- color: Colors.transparent,
- child: TimelineTile(
- alignment: TimelineAlign.manual,
- lineXY: 0.1,
- beforeLineStyle: const LineStyle(
- color: Color(0xffb4f500),
- thickness: 6,
- ),
- afterLineStyle: const LineStyle(
- color: Color(0xffb4f500),
- thickness: 6,
- ),
- indicatorStyle: IndicatorStyle(
- width: 40,
- height: 40,
- indicator: getIndicator(state),
- ),
- startChild: Container(
- child: Column(children: [
- SizedBox(
- height: 1,
- ),
- SizedBox(
- height: 55,
- ),
- done
- ? Offstage()
- : IconButton(
- padding: EdgeInsets.zero,
- alignment: Alignment.centerLeft,
- icon: Icon(
- Icons.skip_next_sharp,
- size: 30,
- color: Colors.orange[300],
- ),
- onPressed: () => skip()),
- ]),
- ),
- endChild: Container(
- padding: EdgeInsets.only(left: 10),
- child: Row(children: [
- Container(
- width: 120,
- height: 80,
- child: Badge(
- elevation: 0,
- padding: EdgeInsets.all(0),
- position: BadgePosition.bottomStart(start: -5),
- animationDuration: Duration(milliseconds: 500),
- animationType: BadgeAnimationType.slide,
- badgeColor: Colors.transparent,
- showBadge: true,
- badgeContent: IconButton(
- onPressed: () => showDialog(
- context: context,
- builder: (BuildContext context) {
- return DialogHTML(
- title: widget.detail.exerciseType!.nameTranslation,
- htmlData: '' + widget.detail.exerciseType!.descriptionTranslation + '
');
- }),
- icon: Icon(
- Icons.info_outline,
- color: Colors.yellow[200],
- )),
- child: Badge(
- elevation: 0,
- padding: EdgeInsets.all(0),
- position: BadgePosition.topEnd(end: -8),
- animationDuration: Duration(milliseconds: 500),
- animationType: BadgeAnimationType.slide,
- badgeColor: Colors.transparent,
- showBadge: buddyWarning,
- badgeContent: IconButton(
- 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: MenuImage(
- imageName: widget.bloc.getActualImageName(widget.detail.exerciseType!.exerciseTypeId),
- workoutTreeId: widget.bloc.getActualWorkoutTreeId(widget.detail.exerciseType!.exerciseTypeId)!,
- radius: 12,
- ))),
- ),
- SizedBox(
- width: 10,
- ),
- Expanded(
- child: RichText(
- text: TextSpan(
- style: GoogleFonts.inter(
- fontSize: 14,
- fontWeight: FontWeight.bold,
- color: done ? Colors.grey[400] : Colors.white,
- ),
- children: [
- TextSpan(
- text: widget.detail.exerciseType!.nameTranslation,
- style: GoogleFonts.inter(
- fontSize: 14,
- fontWeight: FontWeight.bold,
- color: done ? Colors.grey[400] : Colors.orange[500],
- shadows: [
- Shadow(
- offset: Offset(5.0, 5.0),
- blurRadius: 12.0,
- color: Colors.black54,
- ),
- Shadow(
- offset: Offset(-3.0, 3.0),
- blurRadius: 12.0,
- color: Colors.black54,
- ),
- ],
- )),
- widget.detail.exerciseType!.unitQuantityUnit != null && !extraExercise
- ? TextSpan(
- text: "\n",
- )
- : TextSpan(),
- widget.detail.exerciseType!.unitQuantityUnit != null && !extraExercise
- ? TextSpan(
- text: t(widget.detail.exerciseType!.unitQuantityUnit!) + ": ",
- style: GoogleFonts.inter(
- fontSize: 12, color: done ? Colors.grey[100] : Colors.yellow[400], fontWeight: FontWeight.bold))
- : TextSpan(),
- widget.detail.exerciseType!.unitQuantityUnit != null && !extraExercise
- ? TextSpan(
- text: t(weight),
- style: GoogleFonts.inter(
- fontSize: 12,
- ))
- : TextSpan(),
- widget.detail.exerciseType!.unitQuantityUnit != null && !extraExercise && weight != "TEST" && weight != "DROP"
- ? TextSpan(
- text: " - +",
- style: GoogleFonts.archivoBlack(
- color: Colors.blue,
- fontSize: 16,
- ),
- recognizer: _tapRecognizer,
- mouseCursor: SystemMouseCursors.precise,
- )
- : TextSpan(),
- TextSpan(
- text: "\n",
- ),
- !extraExercise
- ? TextSpan(
- text: t(widget.detail.exerciseType!.unit) + ": ",
- style: GoogleFonts.inter(
- fontSize: 12, color: done ? Colors.grey[100] : Colors.yellow[400], fontWeight: FontWeight.bold))
- : TextSpan(),
- !extraExercise
- ? TextSpan(
- text: repeats,
- style: GoogleFonts.inter(
- fontSize: 12,
- ))
- : TextSpan(),
- TextSpan(
- text: "\n",
- ),
- !extraExercise
- ? TextSpan(
- text: t("Set") + ": ",
- style: GoogleFonts.inter(
- fontSize: 12, color: done ? Colors.grey[100] : Colors.yellow[400], fontWeight: FontWeight.bold))
- : TextSpan(),
- !extraExercise
- ? TextSpan(
- text: step + "/" + countSerie,
- style: GoogleFonts.inter(
- fontSize: 12,
- ))
- : TextSpan(),
- TextSpan(
- text: "\n",
- ),
- !extraExercise
- ? TextSpan(
- text: t("Resting time") + ": ",
- style: GoogleFonts.inter(
- fontSize: 12, color: done ? Colors.grey[100] : Colors.yellow[400], fontWeight: FontWeight.bold))
- : TextSpan(),
- !extraExercise
- ? TextSpan(
- text: restingTime + " " + t("min(s)"),
- style:
- GoogleFonts.inter(fontSize: 12, color: done ? Colors.grey[100] : Colors.white, fontWeight: FontWeight.bold))
- : TextSpan(),
- ]),
- )),
- isTest
- ? Container(
- child: Column(mainAxisAlignment: MainAxisAlignment.center, children: [
- GestureDetector(
- onTap: () => showDialog(
- context: context,
- builder: (BuildContext context) {
- return DialogCommon(
- warning: false,
- title: t("Why Test?"),
- descriptions: t("This is your first exercise after at least 3 weeks."),
- description2:
- t("The first exercise will be a test. The following sets will be recalculated base on your test."),
- description3: t("This is the most optimal way for your development"),
- text: "OK",
- onTap: () => Navigator.of(context).pop(),
- onCancel: () => {
- Navigator.of(context).pop(),
- },
- );
- }),
- child: Icon(
- CustomIcon.question_circle,
- color: Colors.yellowAccent[700],
- size: 16,
- )),
- ]))
- : isDrop
- ? Container(
- child: Column(mainAxisAlignment: MainAxisAlignment.center, children: [
- GestureDetector(
- onTap: () => showDialog(
- context: context,
- builder: (BuildContext context) {
- return DialogCommon(
- warning: false,
- title: t("Drop Set"),
- descriptions: t(
- "Execute at least 3 sets with maximum repeats, without resting time, with decreasing the weight."),
- description2:
- t("The goal is to completly exhaust your muscle without lifting a ridiculous weight end the end."),
- text: "OK",
- onTap: () => Navigator.of(context).pop(),
- onCancel: () => {
- Navigator.of(context).pop(),
- },
- );
- }),
- child: Icon(
- CustomIcon.question_circle,
- color: Colors.orange[200],
- size: 16,
- )),
- ]))
- : Offstage()
- ]),
- ),
- ),
- );
- }
-
- void skip() {
- showCupertinoDialog(
- useRootNavigator: true,
- context: context,
- builder: (_) => CupertinoAlertDialog(
- title: Text(t("You want to skip really this exercise?")),
- content: Column(children: [
- Divider(),
- ]),
- actions: [
- TextButton(
- child: Text(t("No")),
- onPressed: () => {
- Navigator.pop(context),
- }),
- TextButton(
- child: Text(t("Yes")),
- onPressed: () {
- Navigator.pop(context);
- widget.bloc.add(TrainingPlanSkipExercise(detail: widget.detail));
- },
- )
- ],
- ));
- }
-}
diff --git a/lib/view/training_plan_exercise.dart b/lib/view/training_plan_exercise.dart
index c8dba62..de8a641 100644
--- a/lib/view/training_plan_exercise.dart
+++ b/lib/view/training_plan_exercise.dart
@@ -2,10 +2,12 @@ import 'dart:collection';
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/cache.dart';
import 'package:aitrainer_app/model/customer_training_plan_details.dart';
import 'package:aitrainer_app/util/trans.dart';
import 'package:aitrainer_app/widgets/app_bar.dart';
import 'package:aitrainer_app/widgets/exercise_save.dart';
+import 'package:aitrainer_app/widgets/menu_image.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:google_fonts/google_fonts.dart';
@@ -26,7 +28,7 @@ class TrainingPlanExercise extends StatelessWidget with Trans {
body: Container(
height: double.infinity,
width: double.infinity,
- padding: EdgeInsets.all(20),
+ //padding: EdgeInsets.all(20),
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage("asset/image/WT_black_background.jpg"),
@@ -75,7 +77,7 @@ class TrainingPlanExercise extends StatelessWidget with Trans {
backgroundColor: Colors.orange[800],
icon: Icon(CustomIcon.save),
label: Text(
- isDropSet ? t("Done") : t("Save"),
+ t("Done"),
style: GoogleFonts.inter(fontWeight: FontWeight.bold, fontSize: 16),
),
),
@@ -92,7 +94,7 @@ class TrainingPlanExercise extends StatelessWidget with Trans {
unit: detail.exerciseType!.unit,
unitQuantityUnit: detail.exerciseType!.unitQuantityUnit,
hasUnitQuantity: detail.exerciseType!.unitQuantityUnit != null,
- weight: detail.weight == -1 ? 0 : detail.weight,
+ weight: detail.weight,
repeats: detail.repeats == -1 ? 99 : detail.repeats,
set: detail.set,
exerciseNr: detail.exercises.length + 1,
@@ -100,6 +102,13 @@ class TrainingPlanExercise extends StatelessWidget with Trans {
onQuantityChanged: (value) => bloc.add(TrainingPlanRepeatsChange(repeats: value.toInt(), detail: detail)),
exerciseTypeId: detail.exerciseType!.exerciseTypeId,
originalQuantity: originalQuantity,
+ tip: ActivityDone.exerciseSaveTrainingTip,
+ menuImage: MenuImage(
+ imageName: bloc.getActualImageName(detail.exerciseType!.exerciseTypeId),
+ workoutTreeId: bloc.getActualWorkoutTreeId(detail.exerciseType!.exerciseTypeId)!,
+ radius: 0,
+ filter: false,
+ ),
);
} else {
return getDropSet(bloc, detail);
diff --git a/lib/view/training_plans_page.dart b/lib/view/training_plans_page.dart
index 90436f3..60b1272 100644
--- a/lib/view/training_plans_page.dart
+++ b/lib/view/training_plans_page.dart
@@ -44,7 +44,7 @@ class MyTrainingPlans extends StatelessWidget with Trans, Logging {
title: t("Warning"),
descriptions: t(state.message),
text: "OK",
- onTap: () => Navigator.of(context).pushNamed("login"),
+ onTap: () => Navigator.of(context).pop(),
onCancel: () => {
Navigator.of(context).pop(),
},
diff --git a/lib/widgets/bmr_widget.dart b/lib/widgets/bmr_widget.dart
index 3246869..aca4e21 100644
--- a/lib/widgets/bmr_widget.dart
+++ b/lib/widgets/bmr_widget.dart
@@ -286,7 +286,7 @@ class _BMRState extends State with Trans {
),
),
mode: Mode.MENU,
- compareFn: (FitnessState i, FitnessState s) => i.isEqual(s),
+ compareFn: (FitnessState? i, FitnessState? s) => i!.isEqual(s),
showSelectedItem: true,
selectedItem: FitnessItem().getItem(fitnessLevel),
itemAsString: (data) => t(data!.stateText),
@@ -301,7 +301,6 @@ class _BMRState extends State with Trans {
color: Colors.yellow[200],
),
));
- //items: FitnessItem().toList()));
}
Widget _customMenuBuilder(BuildContext context, FitnessState? item, bool isSelected) {
diff --git a/lib/widgets/dialog_premium.dart b/lib/widgets/dialog_premium.dart
index 9f2e85a..188f728 100644
--- a/lib/widgets/dialog_premium.dart
+++ b/lib/widgets/dialog_premium.dart
@@ -88,7 +88,7 @@ class _DialogPremiumState extends State with Trans {
alignment: AlignmentDirectional.topEnd,
children: [
Text(
- widget.unlocked ? t("Keep testing") : t("Go Premium") + " ",
+ widget.unlocked ? t("Keep training") : t("Go Premium") + " ",
style: GoogleFonts.archivoBlack(
fontSize: widget.unlocked ? 20 : 24,
color: Colors.yellow[400],
@@ -257,11 +257,7 @@ class _DialogPremiumState extends State with Trans {
list.add(TextSpan(text: t(" ")));
list.add(
TextSpan(
- text: widget.unlockRound == 1
- ? t("the first")
- : widget.unlockRound == 2
- ? t("the second")
- : t("the third"),
+ text: widget.unlockRound.toString() + " " + t("week"),
style: GoogleFonts.inter(
fontSize: 14,
fontWeight: FontWeight.bold,
@@ -282,7 +278,7 @@ class _DialogPremiumState extends State with Trans {
),
);
list.add(TextSpan(text: t(" ")));
- list.add(TextSpan(text: t("100% test circles")));
+ list.add(TextSpan(text: t("100% completed training")));
return list;
}
diff --git a/lib/widgets/dialog_trial.dart b/lib/widgets/dialog_trial.dart
index e3a3f8b..9c8a5e5 100644
--- a/lib/widgets/dialog_trial.dart
+++ b/lib/widgets/dialog_trial.dart
@@ -120,7 +120,7 @@ class _DialogTrialWidgetState extends State with Trans {
children: [
Image.asset('asset/icon/gomb_lila_b.png', width: 100, height: 45),
Text(
- t("Nem"),
+ t("No"),
style: TextStyle(fontSize: 16, color: Colors.white),
),
],
@@ -132,7 +132,7 @@ class _DialogTrialWidgetState extends State with Trans {
children: [
Image.asset('asset/icon/gomb_orange_c.png', width: 100, height: 45),
Text(
- t("Igen"),
+ t("Yes"),
style: TextStyle(fontSize: 16, color: Colors.white),
),
],
diff --git a/lib/widgets/exercise_save.dart b/lib/widgets/exercise_save.dart
index f715382..893d2a8 100644
--- a/lib/widgets/exercise_save.dart
+++ b/lib/widgets/exercise_save.dart
@@ -1,21 +1,113 @@
import 'dart:async';
-import 'package:aitrainer_app/bloc/tutorial/tutorial_bloc.dart';
import 'package:aitrainer_app/library/custom_icon_icons.dart';
+import 'package:aitrainer_app/model/cache.dart';
import 'package:aitrainer_app/util/trans.dart';
+import 'package:aitrainer_app/widgets/menu_image.dart';
import 'package:aitrainer_app/widgets/time_picker.dart';
+import 'package:aitrainer_app/widgets/tutorial_widget.dart';
+import 'package:badges/badges.dart';
import 'package:flutter/material.dart';
import 'package:flutter/scheduler.dart';
-import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:keyboard_actions/keyboard_actions.dart';
import 'package:keyboard_actions/keyboard_actions_config.dart';
import 'package:stop_watch_timer/stop_watch_timer.dart';
import 'package:wakelock/wakelock.dart';
-
-import 'dialog_common.dart';
import 'dialog_html.dart';
+enum Explanations { intro, introBold, explanationWeight, explanationRepeats, explanationButton, explanationButtonExt }
+
+extension ExplanationsExt on Explanations {
+ String toStr() => this.toString().split(".").last;
+ bool equalsTo(Explanations type) => this.toString() == type.toString();
+ bool equalsStringTo(String type) => this.toStr() == type;
+}
+
+class ExplanationExt {
+ final ActivityDone tip;
+ final String? unitQuantityUnit;
+ final double? weight;
+ final int? repeats;
+ ExplanationExt({
+ required this.tip,
+ this.unitQuantityUnit,
+ required this.weight,
+ required this.repeats,
+ });
+
+ String getExplanation(Explanations explanation) {
+ String expl = "";
+ if (this.tip.equalsTo(ActivityDone.exerciseSaveTestTip)) {
+ if (explanation.equalsTo(Explanations.intro)) {
+ expl = "Please take a middle weight which you are able to do 8-20 times with.";
+ } else if (explanation.equalsTo(Explanations.introBold)) {
+ expl = "Execute your MAXIMUM repeats with it!";
+ } else if (explanation.equalsTo(Explanations.explanationWeight)) {
+ expl = "Type here your selected weight,";
+ } else if (explanation.equalsTo(Explanations.explanationRepeats)) {
+ expl = "then here, how many times could you repeat it!";
+ } else if (explanation.equalsTo(Explanations.explanationButton)) {
+ expl = "After you done, click to the OK button!";
+ } else if (explanation.equalsTo(Explanations.explanationButtonExt)) {
+ expl = "";
+ }
+ } else if (this.tip.equalsTo(ActivityDone.exerciseSaveTrainingTip)) {
+ if (unitQuantityUnit != null) {
+ if (weight == -1) {
+ if (explanation.equalsTo(Explanations.intro)) {
+ expl = "Please take a middle weight which you are able to do 8-20 times with.";
+ } else if (explanation.equalsTo(Explanations.introBold)) {
+ expl = "Execute your MAXIMUM repeats with it!";
+ }
+ } else if (repeats == 99) {
+ if (explanation.equalsTo(Explanations.intro)) {
+ expl = "It is time to exhaust your muscles";
+ }
+ } else {
+ if (explanation.equalsTo(Explanations.intro)) {
+ expl = "For your optimal development we calculated a suitable weight and repeats";
+ } else if (explanation.equalsTo(Explanations.introBold)) {
+ expl = "You can change the weight, if you could not set it in the training room";
+ }
+ }
+ if (explanation.equalsTo(Explanations.explanationButtonExt)) {
+ if (repeats != 99) {
+ expl = "If you could do less, then modify and click to OK";
+ }
+ } else if (explanation.equalsTo(Explanations.explanationWeight)) {
+ if (weight == -1 || weight == -2) {
+ expl = "Type here your selected weight,";
+ } else {
+ expl = "Here is your tailored weight,";
+ }
+ } else if (explanation.equalsTo(Explanations.explanationRepeats)) {
+ if (repeats == 99) {
+ expl = "and execute it with maximum repeats!";
+ } else {
+ expl = "and executed with this number of repeats!";
+ }
+ }
+ } else {
+ if (repeats == 99) {
+ if (explanation.equalsTo(Explanations.intro)) {
+ expl = "Please repeat as much times as you can! MAXIMIZE it!";
+ }
+ } else {
+ if (explanation.equalsTo(Explanations.intro)) {
+ expl = "Please try to execute this exercise with exact repeats what is suggested";
+ }
+ }
+ }
+ if (explanation.equalsTo(Explanations.explanationButton)) {
+ expl = "After you done, click to the OK button!";
+ }
+ } else if (this.tip.equalsTo(ActivityDone.exerciseSaveTestsetTip)) {}
+
+ return expl;
+ }
+}
+
// ignore: must_be_immutable
class ExerciseSave extends StatefulWidget {
final ValueChanged onQuantityChanged;
@@ -33,6 +125,8 @@ class ExerciseSave extends StatefulWidget {
final int? set;
final int? exerciseNr;
final int? originalQuantity;
+ final MenuImage menuImage;
+ final ActivityDone? tip;
ExerciseSave(
{required this.onQuantityChanged,
@@ -49,7 +143,9 @@ class ExerciseSave extends StatefulWidget {
this.repeats,
this.set,
this.exerciseNr,
- this.originalQuantity});
+ this.originalQuantity,
+ required this.menuImage,
+ this.tip});
@override
_ExerciseSaveState createState() => _ExerciseSaveState();
}
@@ -72,12 +168,6 @@ class _ExerciseSaveState extends State with Trans {
@override
initState() {
super.initState();
- _controller1.text = widget.weight == null
- ? "0"
- : widget.weight! % widget.weight!.round() == 0
- ? widget.weight!.toStringAsFixed(0)
- : widget.weight!.toStringAsFixed(1);
- _controller2.text = widget.repeats == null ? "12" : widget.repeats!.toStringAsFixed(0);
_nodeText1.addListener(() {
if (_nodeText1.hasFocus) {
_controller1.selection = TextSelection(baseOffset: 0, extentOffset: _controller1.text.length);
@@ -98,25 +188,31 @@ class _ExerciseSaveState extends State with Trans {
}
SchedulerBinding.instance!.addPostFrameCallback((_) {
- /* //final TutorialBloc bloc = BlocProvider.of(context);
- if (bloc.actualCheck == "directTest") {
+ _controller1.text = widget.weight == null || widget.weight == -1
+ ? "--"
+ : widget.weight! % widget.weight!.round() == 0
+ ? widget.weight!.toStringAsFixed(0)
+ : widget.weight!.toStringAsFixed(1);
+ _controller2.text = widget.repeats == null
+ ? "--"
+ : widget.repeats! == 99
+ ? "MAX"
+ : widget.repeats!.toStringAsFixed(0);
+ if (widget.unitQuantityUnit != null && widget.tip != null && Cache().isActivityDone(widget.tip!) == false) {
Timer(
Duration(milliseconds: 2000),
() => {
- showDialog(
- context: context,
- barrierDismissible: false,
- builder: (BuildContext context) {
- return DialogCommon(
- title: t("Attention"),
- descriptions: t(widget.exerciseTask),
- text: "OK",
- onTap: () => Navigator.of(context).pop(),
- onCancel: () => Navigator.of(context).pop(),
- );
- })
+ TutorialWidget().explanation(
+ context,
+ ExplanationWidget(
+ unitQuantityUnit: widget.unitQuantityUnit,
+ unit: widget.unit,
+ tip: widget.tip,
+ weight: widget.weight,
+ repeats: widget.repeats,
+ )),
});
- } */
+ }
});
}
@@ -189,82 +285,139 @@ class _ExerciseSaveState extends State with Trans {
}
Widget getExerciseWidget() {
+ ExplanationExt expl = ExplanationExt(
+ tip: widget.tip!,
+ weight: widget.weight,
+ repeats: widget.repeats,
+ unitQuantityUnit: widget.unitQuantityUnit,
+ );
+
return KeyboardActions(
config: _buildConfig(context),
child: Container(
child: SingleChildScrollView(
scrollDirection: Axis.vertical,
child: Column(mainAxisAlignment: MainAxisAlignment.spaceEvenly, crossAxisAlignment: CrossAxisAlignment.center, children: [
- Text(
- widget.exerciseName,
- style: GoogleFonts.archivoBlack(
- fontWeight: FontWeight.bold,
- fontSize: 24,
- color: Colors.white,
- shadows: [
- Shadow(
- offset: Offset(5.0, 5.0),
- blurRadius: 12.0,
- color: Colors.black54,
- ),
- Shadow(
- offset: Offset(-3.0, 3.0),
- blurRadius: 12.0,
- color: Colors.black54,
- ),
- ],
+ 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: true,
+ badgeContent: IconButton(
+ iconSize: 30,
+ onPressed: () => showDialog(
+ context: context,
+ builder: (BuildContext context) {
+ return DialogHTML(title: widget.exerciseName, htmlData: '' + widget.exerciseDescription + '
');
+ }),
+ icon: Icon(
+ CustomIcon.info_circle,
+ color: Colors.white,
+ )),
+ child: widget.menuImage,
),
- overflow: TextOverflow.fade,
- maxLines: 4,
- softWrap: true,
- textAlign: TextAlign.center,
- ),
- SizedBox(
- height: 15,
- ),
- InkWell(
- child: Text(
- t("Exercise descripton") + " »",
- style: GoogleFonts.inter(fontSize: 12, color: Colors.blue[200]),
+ Container(
+ padding: EdgeInsets.only(left: 10, bottom: 10, right: 10),
+ child: Text(
+ widget.exerciseName,
+ style: GoogleFonts.archivoBlack(
+ fontWeight: FontWeight.bold,
+ fontSize: 24,
+ color: Colors.white,
+ shadows: [
+ Shadow(
+ offset: Offset(5.0, 5.0),
+ blurRadius: 12.0,
+ color: Colors.black54,
+ ),
+ Shadow(
+ offset: Offset(-3.0, 3.0),
+ blurRadius: 12.0,
+ color: Colors.black54,
+ ),
+ ],
+ ),
+ overflow: TextOverflow.fade,
+ maxLines: 4,
+ softWrap: true,
+ ))
+ ]),
+ ListTile(
+ leading: IconButton(
+ iconSize: 30,
+ onPressed: () => {
+ if (widget.unitQuantityUnit != null)
+ {
+ TutorialWidget().explanation(
+ context,
+ ExplanationWidget(
+ unitQuantityUnit: widget.unitQuantityUnit,
+ unit: widget.unit,
+ tip: widget.tip,
+ weight: widget.weight,
+ repeats: widget.repeats,
+ ))
+ }
+ },
+ icon: Icon(
+ CustomIcon.info_circle,
+ color: Colors.orange[100],
+ )),
+ subtitle: Text(
+ t(expl.getExplanation(Explanations.intro)),
+ style: GoogleFonts.inter(
+ fontSize: 14,
+ color: Colors.white,
+ fontWeight: FontWeight.bold,
+ shadows: [
+ Shadow(
+ offset: Offset(2.0, 2.0),
+ blurRadius: 6.0,
+ color: Colors.black54,
+ ),
+ Shadow(
+ offset: Offset(-3.0, 3.0),
+ blurRadius: 12.0,
+ color: Colors.black54,
+ ),
+ ],
+ ),
+ maxLines: 3,
+ textAlign: TextAlign.left,
+ overflow: TextOverflow.fade,
+ softWrap: true,
),
- onTap: () => {
- showDialog(
- context: context,
- builder: (BuildContext context) {
- return DialogHTML(title: widget.exerciseName, htmlData: '' + widget.exerciseDescription + '
');
- })
- },
- ),
- Divider(
- color: Colors.transparent,
- ),
- Text(
- t(widget.exerciseTask),
- style: GoogleFonts.inter(
- fontSize: 14,
- color: Colors.orange,
- fontWeight: FontWeight.bold,
- shadows: [
- Shadow(
- offset: Offset(2.0, 2.0),
- blurRadius: 6.0,
- color: Colors.black54,
- ),
- Shadow(
- offset: Offset(-3.0, 3.0),
- blurRadius: 12.0,
- color: Colors.black54,
- ),
- ],
- ),
- maxLines: 3,
- textAlign: TextAlign.center,
- overflow: TextOverflow.fade,
- softWrap: true,
- ),
- Divider(
- color: Colors.transparent,
),
+ expl.getExplanation(Explanations.introBold).length > 0
+ ? Text(
+ t(expl.getExplanation(Explanations.introBold)),
+ style: GoogleFonts.inter(
+ fontSize: 14,
+ color: Colors.orange,
+ fontWeight: FontWeight.bold,
+ shadows: [
+ Shadow(
+ offset: Offset(2.0, 2.0),
+ blurRadius: 6.0,
+ color: Colors.black54,
+ ),
+ Shadow(
+ offset: Offset(-3.0, 3.0),
+ blurRadius: 12.0,
+ color: Colors.black54,
+ ),
+ ],
+ ),
+ maxLines: 3,
+ textAlign: TextAlign.center,
+ overflow: TextOverflow.fade,
+ softWrap: true,
+ )
+ : Offstage(),
widget.unit == "second"
? Text(
getTimeGoal(widget.originalQuantity),
@@ -289,29 +442,60 @@ class _ExerciseSaveState extends State with Trans {
)
: Offstage(),
columnQuantityUnit(),
- Divider(
- color: Colors.transparent,
- ),
columnQuantity(),
Divider(
color: Colors.transparent,
),
- widget.hasUnitQuantity
- ? Text(
- widget.set == null || widget.exerciseNr == null
- ? t("Step") + ": " + "1/4"
- : t("Step") + ": " + "${widget.exerciseNr}/${widget.set}",
- style: GoogleFonts.inter(
- fontSize: 22,
- color: Colors.white,
- fontWeight: FontWeight.bold,
- ),
- maxLines: 3,
- textAlign: TextAlign.center,
- overflow: TextOverflow.fade,
- softWrap: true,
- )
- : Offstage(),
+ Text(
+ t(expl.getExplanation(Explanations.explanationButton)),
+ style: GoogleFonts.inter(
+ fontSize: 14,
+ color: Colors.white,
+ fontWeight: FontWeight.bold,
+ shadows: [
+ Shadow(
+ offset: Offset(2.0, 2.0),
+ blurRadius: 6.0,
+ color: Colors.black54,
+ ),
+ Shadow(
+ offset: Offset(-3.0, 3.0),
+ blurRadius: 12.0,
+ color: Colors.black54,
+ ),
+ ],
+ ),
+ maxLines: 3,
+ textAlign: TextAlign.center,
+ overflow: TextOverflow.fade,
+ softWrap: true,
+ ),
+ Padding(
+ padding: const EdgeInsets.only(left: 35, right: 35),
+ child: Text(
+ t(expl.getExplanation(Explanations.explanationButtonExt)),
+ style: GoogleFonts.inter(
+ fontSize: 14,
+ color: Colors.orange,
+ fontWeight: FontWeight.bold,
+ shadows: [
+ Shadow(
+ offset: Offset(2.0, 2.0),
+ blurRadius: 6.0,
+ color: Colors.black54,
+ ),
+ Shadow(
+ offset: Offset(-3.0, 3.0),
+ blurRadius: 12.0,
+ color: Colors.black54,
+ ),
+ ],
+ ),
+ maxLines: 3,
+ textAlign: TextAlign.center,
+ overflow: TextOverflow.fade,
+ softWrap: true,
+ )),
Divider(
color: Colors.transparent,
),
@@ -476,3 +660,168 @@ class _ExerciseSaveState extends State with Trans {
return row;
}
}
+
+class ExplanationWidget extends StatefulWidget {
+ final String? unitQuantityUnit;
+ final String unit;
+ final ActivityDone? tip;
+ final double? weight;
+ final int? repeats;
+ const ExplanationWidget({
+ Key? key,
+ this.unitQuantityUnit,
+ required this.unit,
+ this.tip,
+ this.weight,
+ this.repeats,
+ }) : super(key: key);
+
+ @override
+ _ExplanationWidgetState createState() => _ExplanationWidgetState();
+}
+
+class _ExplanationWidgetState extends State with Trans {
+ bool _selected = false;
+
+ @override
+ Widget build(BuildContext context) {
+ ExplanationExt expl = ExplanationExt(
+ tip: widget.tip!,
+ weight: widget.weight,
+ repeats: widget.repeats,
+ unitQuantityUnit: widget.unitQuantityUnit,
+ );
+ setContext(context);
+ return Material(
+ color: Colors.transparent,
+ child: Column(
+ children: [
+ Padding(
+ padding: const EdgeInsets.only(top: 10, left: 10, right: 10),
+ child: Text(t(expl.getExplanation(Explanations.intro)),
+ maxLines: 5,
+ textAlign: TextAlign.center,
+ style: GoogleFonts.inter(
+ color: Colors.white,
+ fontWeight: FontWeight.bold,
+ fontSize: 16,
+ ))),
+ Padding(
+ padding: const EdgeInsets.only(top: 10, left: 10, right: 10),
+ child: Text(t(expl.getExplanation(Explanations.introBold)),
+ maxLines: 5,
+ textAlign: TextAlign.center,
+ style: GoogleFonts.inter(
+ color: Colors.orange,
+ fontWeight: FontWeight.bold,
+ fontSize: 16,
+ ))),
+ Stack(children: [
+ Padding(
+ padding: const EdgeInsets.only(top: 13, left: 18, right: 18),
+ child: Column(mainAxisAlignment: MainAxisAlignment.spaceAround, children: [
+ TextFormField(
+ decoration: InputDecoration(
+ contentPadding: EdgeInsets.only(left: 25, top: 5, bottom: 5),
+ labelText: t(widget.unitQuantityUnit!),
+ labelStyle: GoogleFonts.inter(fontSize: 20, color: Colors.yellow[50]),
+ fillColor: Colors.black38,
+ filled: true,
+ border: OutlineInputBorder(
+ gapPadding: 8.0,
+ borderRadius: BorderRadius.circular(12.0),
+ borderSide: BorderSide(color: Colors.white12, width: 0.4),
+ ),
+ ),
+ initialValue: ".",
+ keyboardType: TextInputType.numberWithOptions(decimal: true),
+ textInputAction: TextInputAction.done,
+ style: GoogleFonts.archivoBlack(fontSize: 80, color: Colors.transparent),
+ onChanged: (value) {}),
+ ])),
+ Container(
+ padding: EdgeInsets.only(top: 35, left: 35, right: 35),
+ child: Text(
+ t(expl.getExplanation(Explanations.explanationWeight)),
+ style: GoogleFonts.archivoBlack(fontSize: 23, color: Colors.yellow[300]),
+ )),
+ ]),
+ Stack(children: [
+ Padding(
+ padding: const EdgeInsets.only(top: 10, left: 15, right: 15),
+ child: Column(mainAxisAlignment: MainAxisAlignment.spaceAround, children: [
+ TextFormField(
+ decoration: InputDecoration(
+ contentPadding: EdgeInsets.only(left: 25, top: 5, bottom: 5),
+ labelText: t(widget.unit),
+ labelStyle: GoogleFonts.inter(fontSize: 20, color: Colors.yellow[50]),
+ fillColor: Colors.black38,
+ filled: true,
+ border: OutlineInputBorder(
+ gapPadding: 8.0,
+ borderRadius: BorderRadius.circular(12.0),
+ borderSide: BorderSide(color: Colors.white12, width: 0.4),
+ ),
+ ),
+ initialValue: ".",
+ keyboardType: TextInputType.numberWithOptions(decimal: true),
+ textInputAction: TextInputAction.done,
+ style: GoogleFonts.archivoBlack(fontSize: 80, color: Colors.transparent),
+ onChanged: (value) {}),
+ ])),
+ Container(
+ padding: EdgeInsets.only(top: 25, left: 35, right: 35),
+ child: Text(
+ t(expl.getExplanation(Explanations.explanationRepeats)),
+ style: GoogleFonts.archivoBlack(fontSize: 23, color: Colors.yellow[300]),
+ )),
+ ]),
+ Padding(
+ padding: const EdgeInsets.only(top: 10, left: 5, right: 5),
+ child: Text(
+ t("Don't forget, the app can give you only the right values, if you execute the task regurarly and after the exact instructions."),
+ maxLines: 5,
+ textAlign: TextAlign.center,
+ style: GoogleFonts.inter(
+ color: Colors.white,
+ fontSize: 14,
+ ))),
+ Divider(),
+ GestureDetector(
+ onTap: () => {
+ TutorialWidget().close(),
+ if (_selected && widget.tip != null)
+ {
+ Cache().setActivityDonePrefs(widget.tip!),
+ }
+ },
+ child: Stack(
+ alignment: Alignment.center,
+ children: [
+ Image.asset('asset/icon/gomb_orange_c.png', width: 100, height: 45),
+ Text(
+ t("Got It"),
+ style: TextStyle(fontSize: 20, color: Colors.white),
+ ),
+ ],
+ )),
+ Theme(
+ data: ThemeData(unselectedWidgetColor: Colors.white38),
+ child: CheckboxListTile(
+ value: _selected,
+ onChanged: (bool? checked) {
+ setState(() {
+ _selected = checked!;
+ });
+ },
+ checkColor: Colors.white,
+ activeColor: Colors.orange[600],
+ controlAffinity: ListTileControlAffinity.leading,
+ title: Text(
+ t("Show this tip no more"),
+ style: GoogleFonts.inter(color: Colors.grey),
+ )))
+ ],
+ ));
+ }
+}
diff --git a/lib/widgets/menu_page_widget.dart b/lib/widgets/menu_page_widget.dart
index b69cf1b..4132f1c 100644
--- a/lib/widgets/menu_page_widget.dart
+++ b/lib/widgets/menu_page_widget.dart
@@ -83,16 +83,16 @@ class _MenuPageWidgetState extends State with Trans, Logging {
context: context,
builder: (BuildContext context) {
return DialogTrialWidget(
- title: "10 days Premium for free",
- description: "Would you like to try all premium functions for 10 days, without any subscription or bank card data?",
+ title: t("10 days Premium for free"),
+ description: t("Would you like to try all premium functions for 10 days, without any subscription or bank card data?"),
widget: Column(children: [
Text(
- "If you click to 'Yes', all premium functions will be available right now.",
+ t("If you click to 'Yes', all premium functions will be available right now."),
style: GoogleFonts.inter(color: Colors.white),
),
Divider(),
Text(
- "If you click to 'No', you can use all basic functions, and you will loose the oppurtunity to try the premium functions for free.",
+ t("If you click to 'No', you can use all basic functions, and you will loose the oppurtunity to try the premium functions for free."),
style: GoogleFonts.inter(color: Colors.white),
),
]),
diff --git a/lib/widgets/tutorial_widget.dart b/lib/widgets/tutorial_widget.dart
index f17e9ea..4318820 100644
--- a/lib/widgets/tutorial_widget.dart
+++ b/lib/widgets/tutorial_widget.dart
@@ -25,6 +25,46 @@ class TutorialWidget with Trans, Logging {
}
}
+ Widget explanationFrame(Widget widget) {
+ return Container(
+ decoration: BoxDecoration(
+ borderRadius: BorderRadius.circular(24),
+ boxShadow: [BoxShadow(color: Colors.black, offset: Offset(0, 10), blurRadius: 10)],
+ image: DecorationImage(
+ image: AssetImage('asset/image/WT_plainblack_background.jpg'),
+ fit: BoxFit.cover,
+ alignment: Alignment.center,
+ ),
+ ),
+ child: widget,
+ );
+ }
+
+ void explanation(BuildContext context, Widget widget) {
+ tooltip = SuperTooltip(
+ top: 120,
+ left: 20,
+ right: 20,
+ backgroundColor: Colors.black87,
+ popupDirection: TooltipDirection.up,
+ maxWidth: 330,
+ borderColor: Colors.transparent,
+ borderWidth: 1.0,
+ minimumOutSidePadding: 20,
+ //snapsFarAwayVertically: false,
+ showCloseButton: ShowCloseButton.outside,
+ closeButtonColor: Colors.grey,
+ dismissOnTapOutside: true,
+ outsideBackgroundColor: Colors.black.withOpacity(0.6),
+ hasShadow: true,
+ touchThrougArea: null,
+ //onClose: () => bloc.add(TutorialFinished()),
+ custom: true,
+ content: explanationFrame(widget));
+
+ tooltip!.showBox(context);
+ }
+
void tip(BuildContext context) {
final TutorialBloc bloc = BlocProvider.of(context);
if (bloc.action == null) {
diff --git a/pubspec.lock b/pubspec.lock
index 84233de..4cde0b3 100644
--- a/pubspec.lock
+++ b/pubspec.lock
@@ -707,6 +707,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
+ mailto:
+ dependency: "direct main"
+ description:
+ name: mailto
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "2.0.0"
matcher:
dependency: transitive
description:
@@ -1294,12 +1301,12 @@ packages:
source: hosted
version: "3.5.1"
url_launcher:
- dependency: transitive
+ dependency: "direct main"
description:
name: url_launcher
url: "https://pub.dartlang.org"
source: hosted
- version: "6.0.3"
+ version: "6.0.9"
url_launcher_linux:
dependency: transitive
description:
@@ -1320,7 +1327,7 @@ packages:
name: url_launcher_platform_interface
url: "https://pub.dartlang.org"
source: hosted
- version: "2.0.2"
+ version: "2.0.4"
url_launcher_web:
dependency: transitive
description:
diff --git a/pubspec.yaml b/pubspec.yaml
index 0594500..f3dd53d 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -58,7 +58,9 @@ dependencies:
upgrader: ^3.5.1
web_browser: ^0.5.0
flutter_fadein: ^2.0.0
-
+ mailto: ^2.0.0
+ url_launcher: ^6.0.9
+
firebase_core: ^1.5.0
firebase_analytics: ^8.1.0
firebase_messaging: ^10.0.0
@@ -280,6 +282,7 @@ flutter:
- asset/menu/close_grip_front_lat_pulldown.jpg
- asset/menu/close_grip_pull_ups.jpg
- asset/menu/close_reverse_grip_lat_pulldown.jpg
+ - asset/menu/close_reverse_grip_pull_ups.jpg
- asset/menu/concentration.jpg
- asset/menu/cooper.jpg
- asset/menu/crisscross.jpg
@@ -294,6 +297,7 @@ flutter:
- asset/menu/donkey_calf_raises.jpg
- asset/menu/dumbbell_alternate_bicep_curl.jpg
- asset/menu/dumbell_bench_presses.jpg
+ - asset/menu/dumbbell_presses.jpg
- asset/menu/ez_bar_burl.jpg
- asset/menu/flyes.jpg
- asset/menu/forward_raise.jpg
@@ -358,6 +362,7 @@ flutter:
- asset/menu/seated_dumbbell_curl.jpg
- asset/menu/seated_dumbbell_shoulder_press.jpg
- asset/menu/seated_lateral_raises.jpg
+ - asset/menu/seated_leg_curls.jpg
- asset/menu/seated_triceps_extension.jpg
- asset/menu/shrugs.jpg
- asset/menu/side_plank.jpg
@@ -372,6 +377,7 @@ flutter:
- asset/menu/sizes.jpg
- asset/menu/smith_machine_chest_press.jpg
- asset/menu/smith_machine_squats.jpg
+ - asset/menu/smith_machine_front_press.jpg
- asset/menu/squats_with_kettlebell.jpg
- asset/menu/squat_jump_weight.jpg
- asset/menu/squat_jump.jpg
@@ -388,6 +394,7 @@ flutter:
- asset/menu/standing_single_arm_lateral_raises.jpg
- asset/menu/standing_triceps_extension.jpg
- asset/menu/stiff_legged_deadlift.jpg
+ - asset/menu/straight_arm_pulldown.jpg
- asset/menu/straight-arm_rope_pull-down.jpg
- asset/menu/stretching.jpg
- asset/menu/t_bar_rows.jpg