WT 1.1.13 Test Central bug fixes
This commit is contained in:
@@ -11,7 +11,7 @@ import 'package:aitrainer_app/widgets/dialog_html.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:liquid_progress_indicator/liquid_progress_indicator.dart';
|
||||
import 'package:aitrainer_app/library/liquid_progress_indicator/liquid_custom_progress_indicator.dart';
|
||||
import 'package:modal_progress_hud_nsn/modal_progress_hud_nsn.dart';
|
||||
import 'package:rainbow_color/rainbow_color.dart';
|
||||
|
||||
@@ -598,9 +598,9 @@ class _AnimatedLiquidCustomProgressIndicatorState extends State<_AnimatedLiquidC
|
||||
vsync: this,
|
||||
duration: Duration(seconds: 3),
|
||||
)..addListener(() {
|
||||
setState(() {
|
||||
/* setState(() {
|
||||
print("build animation state change");
|
||||
});
|
||||
}); */
|
||||
});
|
||||
|
||||
_animationController.forward();
|
||||
@@ -608,7 +608,7 @@ class _AnimatedLiquidCustomProgressIndicatorState extends State<_AnimatedLiquidC
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
buildAnimation();
|
||||
//buildAnimation();
|
||||
super.initState();
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
|
||||
import '../bloc/customer_change/customer_change_bloc.dart';
|
||||
import '../library/dropdown_search.dart';
|
||||
import '../library/dropdown_search/dropdown_search.dart';
|
||||
|
||||
// ignore: must_be_immutable
|
||||
class CustomerFitnessPage extends StatefulWidget {
|
||||
|
||||
@@ -136,7 +136,7 @@ class _ExercisePlanDetailAddPage extends State<ExercisePlanDetailAddPage> with T
|
||||
final bool weightVisible = bloc.exercisePlanRepository.getActualPlanDetail()!.exerciseType!.unitQuantityUnit != null;
|
||||
String summary = bloc.serie!.toStringAsFixed(0) + " x " + bloc.quantity.toStringAsFixed(0);
|
||||
if (bloc.quantityUnit > 0) {
|
||||
summary += " x " + bloc.quantityUnit.toStringAsFixed(0) + " kg";
|
||||
summary += " x " + bloc.quantityUnit.toStringAsFixed(1) + " kg";
|
||||
}
|
||||
final String unit = bloc.exercisePlanRepository.getActualPlanDetail()!.exerciseType!.unit;
|
||||
return Form(
|
||||
@@ -237,11 +237,15 @@ class _ExercisePlanDetailAddPage extends State<ExercisePlanDetailAddPage> with T
|
||||
),
|
||||
),
|
||||
focusNode: _nodeText3,
|
||||
initialValue: bloc.quantityUnit.toStringAsFixed(0),
|
||||
initialValue: bloc.quantityUnit.toStringAsFixed(1),
|
||||
keyboardType: TextInputType.numberWithOptions(decimal: true),
|
||||
style: GoogleFonts.archivoBlack(fontSize: 60, color: Colors.yellow[200]),
|
||||
onChanged: (value) => {
|
||||
if (value.isNotEmpty) {bloc.add(ExercisePlanCustomAddChangeQuantityUnit(quantity: double.parse(value)))}
|
||||
if (value.isNotEmpty)
|
||||
{
|
||||
value = value.replaceFirst(",", "."),
|
||||
bloc.add(ExercisePlanCustomAddChangeQuantityUnit(quantity: double.parse(value)))
|
||||
}
|
||||
})
|
||||
: Offstage(),
|
||||
|
||||
|
||||
+122
-85
@@ -3,6 +3,7 @@ import 'dart:collection';
|
||||
import 'package:aitrainer_app/bloc/menu/menu_bloc.dart';
|
||||
import 'package:aitrainer_app/bloc/test_set_edit/test_set_edit_bloc.dart';
|
||||
import 'package:aitrainer_app/library/custom_icon_icons.dart';
|
||||
import 'package:aitrainer_app/model/cache.dart';
|
||||
import 'package:aitrainer_app/model/exercise_type.dart';
|
||||
import 'package:aitrainer_app/model/workout_menu_tree.dart';
|
||||
import 'package:aitrainer_app/util/trans.dart';
|
||||
@@ -10,6 +11,7 @@ import 'package:aitrainer_app/widgets/app_bar.dart';
|
||||
import 'package:aitrainer_app/widgets/dialog_common.dart';
|
||||
import 'package:aitrainer_app/widgets/menu_image.dart';
|
||||
import 'package:carousel_slider/carousel_slider.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
@@ -25,6 +27,7 @@ class TestSetEdit extends StatelessWidget with Trans {
|
||||
// ignore: close_sinks
|
||||
final MenuBloc menuBloc = BlocProvider.of<MenuBloc>(context);
|
||||
late TestSetEditBloc? bloc;
|
||||
final bool activeExercisePlan = Cache().activeExercisePlan != null;
|
||||
|
||||
setContext(context);
|
||||
return Scaffold(
|
||||
@@ -65,24 +68,39 @@ class TestSetEdit extends StatelessWidget with Trans {
|
||||
);
|
||||
}))),
|
||||
floatingActionButton: FloatingActionButton.extended(
|
||||
onPressed: () => showDialog(
|
||||
context: context,
|
||||
barrierDismissible: false,
|
||||
builder: (BuildContext context) {
|
||||
return DialogCommon(
|
||||
title: "Start!",
|
||||
descriptions: t("Enjoy the exercises, good luck with the testing!"),
|
||||
text: "OK",
|
||||
onTap: () => {
|
||||
Navigator.of(context).pop(),
|
||||
if (bloc != null)
|
||||
{
|
||||
bloc!.add(TestSetEditSubmit()),
|
||||
}
|
||||
},
|
||||
onCancel: () => {Navigator.of(context).pop()},
|
||||
);
|
||||
}),
|
||||
onPressed: () {
|
||||
if (activeExercisePlan) {
|
||||
showCupertinoDialog(
|
||||
useRootNavigator: true,
|
||||
context: context,
|
||||
builder: (_) => CupertinoAlertDialog(
|
||||
title: Text(t("You have an active Test Set!") + "\n" + Cache().activeExercisePlan!.name),
|
||||
content: Column(children: [
|
||||
Divider(),
|
||||
Text(t("Do you want to override it?"), style: GoogleFonts.inter(color: Colors.black, fontSize: 16)),
|
||||
]),
|
||||
actions: [
|
||||
TextButton(
|
||||
child: Text(t("No, bring me there"), textAlign: TextAlign.center),
|
||||
onPressed: () => {
|
||||
Navigator.pop(context),
|
||||
Navigator.pop(context),
|
||||
Navigator.of(context).pushNamed("testSetExecute"),
|
||||
},
|
||||
),
|
||||
TextButton(
|
||||
child: Text(t("Yes")),
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
startTrainingDialog(bloc);
|
||||
},
|
||||
)
|
||||
],
|
||||
));
|
||||
} else {
|
||||
startTrainingDialog(bloc);
|
||||
}
|
||||
},
|
||||
backgroundColor: Colors.orange[800],
|
||||
icon: Icon(CustomIcon.clock),
|
||||
label: Text(
|
||||
@@ -93,6 +111,27 @@ class TestSetEdit extends StatelessWidget with Trans {
|
||||
);
|
||||
}
|
||||
|
||||
void startTrainingDialog(TestSetEditBloc? bloc) {
|
||||
showDialog(
|
||||
context: context,
|
||||
barrierDismissible: false,
|
||||
builder: (BuildContext context) {
|
||||
return DialogCommon(
|
||||
title: "Start!",
|
||||
descriptions: t("Enjoy the exercises, good luck with the testing!"),
|
||||
text: "OK",
|
||||
onTap: () => {
|
||||
Navigator.of(context).pop(),
|
||||
if (bloc != null)
|
||||
{
|
||||
bloc.add(TestSetEditSubmit()),
|
||||
}
|
||||
},
|
||||
onCancel: () => {Navigator.of(context).pop()},
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
Widget getTestSetWidget(TestSetEditBloc bloc, String templateName) {
|
||||
return Container(
|
||||
padding: EdgeInsets.only(left: 10, right: 10),
|
||||
@@ -155,97 +194,95 @@ class TestSetEdit extends StatelessWidget with Trans {
|
||||
]));
|
||||
}
|
||||
|
||||
List<Widget> imageSliders(List<WorkoutMenuTree> alternatives, MenuBloc menuBloc, WorkoutMenuTree workoutTree, TestSetEditBloc bloc) {
|
||||
List<Widget> imageSliders(int index, WorkoutMenuTree? workoutTree, TestSetEditBloc bloc) {
|
||||
final List<Widget> list = [];
|
||||
if (bloc.exercisePlanDetails[workoutTree.exerciseTypeId] == null) {
|
||||
list.add(Container(
|
||||
padding: EdgeInsets.only(top: 25, bottom: 25),
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(24.0),
|
||||
child: Container(
|
||||
color: Colors.red[600],
|
||||
child: Center(
|
||||
child: Text(
|
||||
"X",
|
||||
style: GoogleFonts.archivoBlack(
|
||||
color: Colors.white,
|
||||
fontSize: 80,
|
||||
),
|
||||
),
|
||||
)))));
|
||||
list.add(getImageStack(workoutTree, menuBloc, bloc));
|
||||
} else {
|
||||
ExerciseType exerciseType = bloc.exercisePlanDetails[workoutTree.exerciseTypeId];
|
||||
bool deleted = workoutTree == null;
|
||||
bloc.displayPlanDetails[index].forEach((value) {
|
||||
ExerciseType alternative = value;
|
||||
|
||||
final WorkoutMenuTree actualWorkoutTree = bloc.menuBloc.menuTreeRepository.getMenuItemByExerciseTypeId(exerciseType.exerciseTypeId)!;
|
||||
list.add(getImageStack(actualWorkoutTree, menuBloc, bloc));
|
||||
}
|
||||
final WorkoutMenuTree? workoutTreeAlternative =
|
||||
bloc.menuBloc.menuTreeRepository.getMenuItemByExerciseTypeId(alternative.exerciseTypeId);
|
||||
|
||||
alternatives.forEach((element) {
|
||||
if (workoutTree.exerciseTypeId != element.exerciseTypeId) {
|
||||
list.add(getImageStack(element, menuBloc, bloc));
|
||||
}
|
||||
list.add(getImageStack(workoutTreeAlternative!, bloc, index, deleted));
|
||||
});
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
Stack getImageStack(WorkoutMenuTree element, MenuBloc menuBloc, TestSetEditBloc bloc) {
|
||||
Stack getImageStack(WorkoutMenuTree element, TestSetEditBloc bloc, int index, bool deleted) {
|
||||
return Stack(alignment: Alignment.topRight, children: [
|
||||
Stack(alignment: Alignment.bottomLeft, children: [
|
||||
MenuImage(imageName: element.imageName, workoutTreeId: element.id),
|
||||
deleted
|
||||
? Opacity(opacity: 0.2, child: MenuImage(imageName: element.imageName, workoutTreeId: element.id))
|
||||
: MenuImage(imageName: element.imageName, workoutTreeId: element.id),
|
||||
Container(
|
||||
padding: EdgeInsets.only(left: 15, bottom: 15, right: 15),
|
||||
child: Text(
|
||||
element.name,
|
||||
maxLines: 4,
|
||||
style: GoogleFonts.archivoBlack(color: element.color, fontSize: 16, height: 1.1),
|
||||
style: GoogleFonts.archivoBlack(color: deleted ? element.color.withOpacity(0.2) : element.color, fontSize: 16, height: 1.1),
|
||||
),
|
||||
),
|
||||
]),
|
||||
Container(
|
||||
width: 40,
|
||||
height: 40,
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(24.0),
|
||||
child: GestureDetector(
|
||||
onTap: () => bloc.add(TestSetEditDeleteExerciseType(exerciseTypeId: element.exerciseTypeId)),
|
||||
child: Container(
|
||||
color: Colors.red[600],
|
||||
child: Center(
|
||||
child: Text(
|
||||
"X",
|
||||
style: GoogleFonts.archivoBlack(
|
||||
color: Colors.white,
|
||||
fontSize: 28,
|
||||
),
|
||||
),
|
||||
)))))
|
||||
deleted == false
|
||||
? Container(
|
||||
width: 40,
|
||||
height: 40,
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(24.0),
|
||||
child: GestureDetector(
|
||||
onTap: () => bloc.add(TestSetEditDeleteExerciseType(indexKey: index)),
|
||||
child: Container(
|
||||
color: Colors.red[600],
|
||||
child: Center(
|
||||
child: Text(
|
||||
"X",
|
||||
style: GoogleFonts.archivoBlack(
|
||||
color: Colors.white,
|
||||
fontSize: 28,
|
||||
),
|
||||
),
|
||||
)))))
|
||||
: Container(
|
||||
width: 40,
|
||||
height: 40,
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(24.0),
|
||||
child: GestureDetector(
|
||||
onTap: () => bloc.add(TestSetEditAddExerciseType(indexKey: index)),
|
||||
child: Container(
|
||||
color: Colors.yellow[700],
|
||||
child: Center(
|
||||
child: Icon(
|
||||
Icons.undo_sharp,
|
||||
size: 40,
|
||||
color: Colors.white,
|
||||
)),
|
||||
))))
|
||||
]);
|
||||
}
|
||||
|
||||
List<Widget> getExerciseTypeWidgets(TestSetEditBloc bloc) {
|
||||
final List<Widget> widgets = [];
|
||||
bloc.exerciseTypes.forEach((element) {
|
||||
final WorkoutMenuTree? workoutTree = bloc.menuBloc.menuTreeRepository.getMenuItemByExerciseTypeId(element.exerciseTypeId);
|
||||
|
||||
final List<WorkoutMenuTree>? alternativeMenuItems = bloc.menuBloc.menuTreeRepository.getWorkoutTreeAlternatives(workoutTree);
|
||||
if (workoutTree != null && alternativeMenuItems != null) {
|
||||
final Widget widget = CarouselSlider(
|
||||
options: CarouselOptions(
|
||||
viewportFraction: 0.80,
|
||||
reverse: false,
|
||||
enableInfiniteScroll: false,
|
||||
autoPlay: false,
|
||||
aspectRatio: 2,
|
||||
enlargeCenterPage: true,
|
||||
onPageChanged: (index, reason) =>
|
||||
bloc.add(TestSetEditChangeExerciseType(index: index, exerciseTypeId: element.exerciseTypeId)),
|
||||
enlargeStrategy: CenterPageEnlargeStrategy.scale),
|
||||
items: imageSliders(alternativeMenuItems, bloc.menuBloc, workoutTree, bloc),
|
||||
);
|
||||
widgets.add(widget);
|
||||
bloc.exercisePlanDetails.forEach((key, element) {
|
||||
WorkoutMenuTree? workoutTree;
|
||||
if (element != null) {
|
||||
workoutTree = bloc.menuBloc.menuTreeRepository.getMenuItemByExerciseTypeId(element.exerciseTypeId);
|
||||
}
|
||||
|
||||
final Widget widget = CarouselSlider(
|
||||
options: CarouselOptions(
|
||||
viewportFraction: 0.80,
|
||||
reverse: false,
|
||||
enableInfiniteScroll: false,
|
||||
autoPlay: false,
|
||||
aspectRatio: 2,
|
||||
enlargeCenterPage: true,
|
||||
onPageChanged: (index, reason) => bloc.add(TestSetEditChangeExerciseType(index: index, indexKey: key)),
|
||||
enlargeStrategy: CenterPageEnlargeStrategy.scale),
|
||||
items: imageSliders(key, workoutTree, bloc),
|
||||
);
|
||||
widgets.add(widget);
|
||||
});
|
||||
return widgets;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ import 'dart:collection';
|
||||
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/library/fade_in.dart';
|
||||
import 'package:aitrainer_app/model/cache.dart';
|
||||
import 'package:aitrainer_app/model/exercise_plan_detail.dart';
|
||||
import 'package:aitrainer_app/repository/exercise_repository.dart';
|
||||
@@ -32,7 +31,7 @@ class TestSetExecute extends StatelessWidget with Trans {
|
||||
executeBloc.add(TestSetExecuteLoad());
|
||||
setContext(context);
|
||||
return Scaffold(
|
||||
appBar: AppBarNav(depth: 1),
|
||||
appBar: AppBarNav(depth: 0),
|
||||
body: Container(
|
||||
padding: EdgeInsets.all(20),
|
||||
decoration: BoxDecoration(
|
||||
@@ -349,11 +348,7 @@ class _ExerciseTileState extends State<ExerciseTile> with Trans {
|
||||
void initState() {
|
||||
animation.start();
|
||||
animation.addStatusListener((status) {
|
||||
if (status == AnimationStatus.completed) {
|
||||
setState(() {
|
||||
print("animation state completed");
|
||||
});
|
||||
}
|
||||
if (status == AnimationStatus.completed) {}
|
||||
});
|
||||
|
||||
super.initState();
|
||||
@@ -407,7 +402,6 @@ class _ExerciseTileState extends State<ExerciseTile> with Trans {
|
||||
final bool done = state.equalsTo(ExercisePlanDetailState.finished);
|
||||
final String countSerie = widget.exercisePlanDetail.exercises == null ? "1" : (widget.exercisePlanDetail.exercises!.length).toString();
|
||||
final String serie = widget.exercisePlanDetail.exerciseType!.unitQuantityUnit == null ? "/1" : "/4";
|
||||
|
||||
setContext(context);
|
||||
return Container(
|
||||
color: Colors.transparent,
|
||||
|
||||
Reference in New Issue
Block a user